3.3 Type and Signature Declarations
field_decl ::= ["shared"] ["var"] "field"If thefield_kind
method_name "(" formal ")"[type_decl]
[":=" expr] ";" field_kind ::= empty declare accessor method impl(s) and sig(s) | "implementation" declare just accessor method implementation(s)
implementation
keyword is used, then the declaration introduces a field get accessor method implementation, and also a set accessor method implementation if the field is declared with the var
keyword. The result type of the field is used as the type of the second argument of the set accessor method; the result type of the set accessor method is void
.
If the plain field
keyword is used, then the field declaration is syntactic sugar for a field implementation declaration and a field signature declaration. A field declaration of the form
shared? var? field
name(x@obj:type):typeR := expr;
where shared? is either the shared
keyword or empty and var? is the var
keyword or empty, is syntactic sugar for the following declarations:
shared? var?The field signature declaration is itself syntactic sugar for one or two signature declarations, depending on whether thefield
implementation
name(x@obj:type):typeR := expr; var?field
signature name
(type):typeR;
var
keyword was used.
Generated with Harlequin WebMaker