- 18.01 (released) ...
Setting the syntax variant
The specification of the Eiffel programming language has remained largely static over its life, arguably due to its sound initial design. Still, on occasion there will be significant value in evolving Eiffel and adapting it to new challenges. To accommodate this evolution, the Eiffel Software compiler provides a set of compilation variants which offer a balance of syntax support. This starts with compatibility with previously valid syntax, moves through the latest standard, and forward to language features which are currently supported but not yet etched into the standard.
EiffelStudio project settings supports four of these syntax compilation variants:
- Obsolete syntax
- Transitional syntax
- Standard syntax
- Provisional syntax
Because the language, and by necessity the compilation technology too, may at times be a moving target, it is difficult to give precise definitions of what these variants mean at any given time. Today's valid identifier is tomorrow's keyword and vice versa.
Even so, we can use an example from a particular point in time to show the basic idea. At one time, the word indexing was a keyword, and the word note was available for use as a valid identifier. But there came a time that due to a consensus of opinion within the Eiffel standards committee, the role of the keyword
indexing was replaced by a new keyword
note. This meant two things. First that if you had used the keyword
indexing in your classes (and who hadn't?), then at some point you would want to change those occurrences to
note. Second, if you had used the word note as an identifier, then at some point you would have to change your code to use a different identifier it its place.
The Eiffel compiler is savvy enough in some cases to delay the necessity of these changes by considering code in its current context. For example, if a particular keyword is not appropriate in a certain context, then it is only reasonable that when the word is used in that context, it is used as an identifier. But sometimes ambiguities arise that the compiler cannot resolve by analyzing context. It is in these cases that the syntax variants are useful.
So, considering the transition from indexing to note, here are the effects of the first three variants:
If Obsolete syntax is selected, then indexing is used as a keyword. note is allowed as an identifier, but with the warning that it will become a keyword in the future.
If Transitional syntax is selected, both indexing and note are recognized as keywords, and a warning is issued that indexing is an obsolete keyword and should be replaced with note.
If Standard syntax is selected, then indexing is free to be used as an identifier, and note is recognized as a keyword.
When Provisional syntax is selected, it allows the use of certain language constructs which, although supported by the Eiffel Software compiler, may not yet be stamped into the standard (or at least approved for the standard by a consensus of the standard committee). For example, version 6.6 of EiffelStudio includes support for the iteration form of the Eiffel loop construct, which at the time of the release is not yet approved for inclusion in the ISO/ECMA standard ... although it is expected, with reasonable confidence, to become standard in the future. Of course, there is always the risk that, once standardized, the syntax may change some, so selecting Provisional syntax is an acknowledgment of this risk when non-standard language elements are being used.
To set the syntax variant, open Project Settings. Then find the general setting Syntax for the target or group of interest. The value field for Syntax will give you a choice of the available variants when clicked. Select the appropriate variant, then, click OK.