Perfect Developer basic tutorial 5 | This page last modified 2011-10-31 (JAC) |
Class member schemas that do not modify the current object are called using the normal dot-notation.
However, if the schema does modify the current object (i.e. it was declared with a "!" before the name), then the dot is replaced by an exclamation mark. This means that, at the point of call, you can tell that the object is changing. So, for example, given a variable myBook we can use the construct:
to change the state of myBook such that it is recorded as available in paperback.
A schema call is a form of postcondition, so it may only appear where a postcondition is permitted. Apart from following the keyword post in a constructor or schema declaration, one other place you can use a postcondition is in an after expression. So if you have a value such as myFavoriteBook that you can't (or don't want to) change but you nevertheless wish were available in hardback, the expression:
yields a copy of myFavoriteBook with the versions attribute suitably amended. The keyword after can be preceded by any expression, so this:
is equally valid. Note that the precedence of after is very low, so you frequently need to enclose after expressions in brackets.
Save My Place | Glossary | Language Reference Manual |
Copyright © 1997-2012 Escher Technologies Limited. All rights reserved. Information is subject to change without notice. |