[<expr> "."] <method_idn>where
<method_idn> -> ["^"] <idn> [<actual_parms>]The expr denotes the object from which the method is to be selected; it can be omitted within a class to select a method of self. The selection is legal if and only if the (apparent) type of the expression has a method named idn. The method might be parameterized; in this case the actual_parms must allow a successful instantiation (7.7). The optional "" is used only within a subclass definition (10.5) to name an overridden method that comes from the superclass.
A method selection binds (7.9) the object computed by the expr into the method, producing a routine object whose type is the same as that of the method. When the routine runs, it will be able to refer to the bound object as self. Thus, given the following code fragment:
counter = type inc(x: int) end counter c: counter := ... % some initializationthe method selection
c.incbinds "c" into the method, producing a routine object of type "`proc` (x: int)".
Every method invocation is conceptually a method selection followed by a routine invocation. Implementations are expected to optimize the common case in which the call happens immediately; programmers should expect that the code fragment
c.inc(1)will run faster than the code fragment
m: proc(x:int) := c.inc m(1)