State
editEvaluation order must be applicative.
- ????
Not really working separating input and output roles. ????
Only can consider a state holder as one object.
Roles and natural language
editIf you compare natural language to logic you will see there is a a big difference. The primary difference is that variable names are not often used. Instead objects are identified by context. For example in the sentence,
- The dog chased the cat.
There are two roles
- the chaser (dog).
- the chasee (cat).
In logic this might be represented by a function called Chase;
- Chase(dog, cat)
This chasing might occur as part of a day out;
- DayOut(dog, cat, family) = ... Chase(dog, cat) ...
You will see that dog and cat must always passed as parameter. This may be through a series of function calls, purely to get the dog and cat to where they are needed. This is a clumsy manual process that the makes the code less readable, and more brittle.
What we want to say is that the chase method requires a dog and a cat. This implies there for that DayOut needs a dog and a cat. In a real program there may be a deep calling hierarchy.
At some point in the calling hierarchy the dog and cat are provided. This is done by the provide method.
The fundamental language feature that supports this is the role. The term role is borrowed here from movies. An actress appears in a role. As a language feature, the role allows a variable to be carried through from one part of an expression to another, while never being parsed as an explicit parameter. The prime use of the role is hiding and making implicit the parameters parsed into a function.