You can use the Alf editor to create an Alf body for a new default value for a Property (e.g., the attribute of a Class) or to edit the existing Alf body of a Property. The Alf expression for a default value is stored as the the body of an Opaque Expression with the language Alf. Compiling this Alf code results in the creation of an executable Activity that returns the value of the Alf expression. This Activity is linked to the Opaque Expression as its the Behavior property. (See also the discussion on the Alf compiler)
To create a new default value for a Property using Alf
Enter an Alf expression and click on the Save button to compile and save the code.
Note that the text entered must be for an expression, not a statement. Therefore, it must not have a semicolon at the end. |
If the Property already has a non-Alf default value, then, to enter an Alf default value, open its Specification window and proceed as above to create a new default value with an Alf body, replacing the previous default value. |
To edit an existing Alf body for the default value of a Property
The Alf code for a default value can also be entered or edited directly in the Body and Language property in the Specification window for the Opaque Expression. If you open the Edit Body and Language window, then the Alf code may be edited just as in the Alf editor window. However, instead of Save and Revert buttons, this window has OK and Cancel buttons, either of which will close it. If you press OK, then the Alf text is saved, and, if it has no errors, compiled. If you press Cancel, the Alf text is not saved.
To be recognized as Alf code, the Body of an Opaque Expression must have the Language Alf. If your project was created using the Alf project template, then Alf will be the default language. Otherwise, select Alf from the Language menu (you may have to scroll upwards in the menu to find the selection for Alf). |
To make Alf the default language for Opaque Expressions
|
.