Store Statement



next up previous contents index
Next: Return Statement Up: Statements Previous: Simple Statements

Store Statement

A special statement is provided for updating components of array-like types. The statement resembles assignment (5) syntactically, but is really an invocation. It has the form
<primary> "[" <expr1> "]" ":=" <expr2>
(A primary is a limited kind of expression (7.16).) This form is merely a shorthand for an invocation of a store method and is equivalent to the invocation statement
<primary> "." "store" "(" <expr1> "," <expr2> ")"
The evaluation of the primary and the other expressions takes place in an unspecified order.

The form is legal if the corresponding invocation statement is legal, and therefore it is not restricted to arrays but can be used with user-defined types as well. The object resulting from primary must have a procedure method named "store" that takes two arguments whose types are supertypes of the types of expr1 and expr2.

[usage844]



theta-questions@lcs.mit.edu