next up previous
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 $ \longmapsto$ FunctionCall
and that RightValue is generated by the rules
Statement $ \longmapsto$ return RightValue
Assignment $ \longmapsto$ LeftValue := RightValue
RightValue $ \longmapsto$ [ RightValueSequence ]
RightValueSequence $ \longmapsto$ RightValue
RightValueSequence $ \longmapsto$ RightValueSequence , RightValue
Therefore, the (expected) type of a RightValue can always be deduced from its context without evaluating this RightValue: 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 up previous
Next: Integer Up: The ALLCOT semantics Previous: Domains
Marc Moreno Maza
2004-12-01