Next: Integer Up: The ALLCOT semantics Previous: Domains

## Every function is a method or a creator

Remember that, in order to make life simple, ALLCOT is an OO language with functional notations. More precisely, every ALLCOT function is either a method or a creator. Hence, an ALLCOT cannot have static methods. So, consider a function call
```f(a,b,c)
```
We can assume that the types of a, b or c are known. Let T be the type of a.
(1)
If T has a function whose signature matches that of f, then we use this function for the call f(a,b,c).
(2)
Otherwise, we assume that f is a creator. So, we need the return type of f(a,b,c). Observe that the only rule generating a FunctionCall is
 RightValue FunctionCall
and that RightValue is generated by the rules
 Statement return RightValue Assignment LeftValue := RightValue RightValue [ RightValueSequence ] RightValueSequence RightValue RightValueSequence RightValueSequence , RightValue
Therefore, the (expected) type of a RightValue can always be deduced from its context without evaluating this RightValue:
• The type of RightValue in return RightValue is the return type of the function where this return-statement appears.
• The type of RightValue in LeftValue := RightValue must be that of LeftValue, which is known after visiting the node corresponding to LeftValue.
• The type of RightValue in RightValueSequence , RightValue is that of the array being defined.
So, let S be the return-type of f(a,b,c). If the domain S has a function whose signature matches that of f, then we use this function for the call f(a,b,c). Otherwise, we report error.

Next: Integer Up: The ALLCOT semantics Previous: Domains
Marc Moreno Maza
2004-12-01