Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Expressions > Primaries > Accessors > Method invokes

Method invokes

This accessor invokes a method in an object generated by a primary expression (plus previous accessors, if any). The name of the method can be determinted at compile time or at runtime, with an arbitrary expression that is converted to a string yielding the name of the method. Static method selection is somewhat faster than dynamic. If there is no such method, an exception is generated, unless callback ``_invoke()ยดยด is used in classes, in which case the result of invokes are dependent on the class in question.

A splice operator (@) can be used in the same way as in calls, but named parameters cannot be used since a method invoke is never statically bound as an accessor. However, direct reference to the method of the enclosing class followed by a parameter list is statically bound.

Special closure call will only take one parameters, an inline function immediately following the method name or method expression. This form is provided purely because enclosing parenthesis would look really confusing. However, no other parameters may be given with this form.

  acc-invoke := "." symbolname "(" parameters ")" 
  acc-invoke := "." "(" expr ")" "(" parameters ")" 
  acc-invoke := "." symbolname  inline-functionparameter  
  acc-invoke := "." "(" expr ")" inline-functionparameter 
  parameters := param ( "," param )* 
  param := [ "@" ] expr 
See also  | Accessors  | Grammar
Contributes notes:
Add a note
What's new | Anvil