next up previous contents
Next: Feature and Local Declarations Up: Programs Previous: Modifications

Syntactic Replacements

  A parameterless qualification C::a or n.a in a read context is interpreted as a parameterless call C::a or n.a respectively. Every non-private attribute a of type A implicitly defines such a reader method a:A; it is private, if the attribute is private. Qualifications C::a or n.a in write context are replaced by calls C::a(v) or n.a(v) where v is the new value to be written to a. Every non-const attribute a of type A implicitly defines such a writer method a(v:A). These implicitly defined methods are only accessible via the qualification replacements described above. They can only be renamed or overridden by renaming or overriding their attribute.

Note: By defining reader and writer methods b:B and b(v:B), n.b and C::b may be used as if b was defined as an attribute. tex2html_wrap_inline1707

Furthermore the use of any monadic and dyadic operator tex2html_wrap_inline2115 except and and or in an expression is syntactically replaced by a procedure call according to table 4.2. For showing the priorities of operators the table also includes the built in operators or and and.

is_equal is automatically defined for all types but its definition may be overriden by the user.

It is asserted, that plus and times are left associative; is_equal and plus are commutative. pow is right associative. No assumptions are made on any of the other operators. If a user-defined procedure is_equal or plus is not commutative, the result is undefined. Commutativity is not asserted for times.

Furthermore bracketed expression lists for index expressions are replaced according to table 4.1.

   table381
Table 4.1: Replacements for index expressions

x must evaluate to an array object for which the procedures aset and aget are defined with the appropriate number of parameters of appropriate types. The first form is also used when retransmitting out parameters to the caller of a method. The second form is used when tex2html_wrap_inline2131 appears as an operand within an expression.

   table398
Table 4.2: Replacements for unary and binary operators


next up previous contents
Next: Feature and Local Declarations Up: Programs Previous: Modifications

Martin Trapp
Mon Feb 17 16:49:16 MET 1997