Eiffel compatibility options
Introduction
Over the course of several releases, Eiffel Software has introduced a number of options and settings which allow users of EiffelStudio and the Eiffel command line compiler to choose the appropriate level of forward progress and/or backward compatibility for a particular application.
This is a summary of the motivation behind and the meanings of the various compatibility options.
Quick guide to project settings affecting compatibility with older Eiffel code
The table below shows project settings that, depending upon their values, can affect the compilation of Eiffel code produced under older standards. That is, certain values for some of these settings may cause older code to fail to compile due to non-compliance. However, other values may allow you to compile non-compliant code during a period in which you convert that code to the current Eiffel implementation.
Setting | Allowable values | Meaning | Default value in version: |
---|---|---|---|
Syntax | |||
Obsolete syntax | Favor obsolete syntax over standard. | 6.3, 6.4 | |
Transitional syntax | Favor standard syntax, but allow obsolete syntax when determinable by context. | 6.8, 6.7, 6.6, 6.5 | |
Standard syntax | Enforce current standard syntax. | 7.0 and more recent | |
Provisional syntax | Like Transitional syntax, but also allow not-yet-approved constructs. | ||
Full class checking | |||
True | Features of parent classes are rechecked for validity in heir classes. | 7.3 and more recent | |
False | No recheck performed. | 7.2, 7.1, 7.0, 6.8, 6.7, 6.6, 6.5 | |
Are types attached by default? | |||
True | x: T is treated like x: attached T | 7.0 and more recent | |
False | x: T is treated like x: detachable T | 6.8, 6.7, 6.6, 6.5 | |
Void-safety | |||
No | No checking against any void-safety validity rules. | 7.2, 7.1, 7.0, 6.8, 6.7, 6.6, 6.5 | |
Conformance | The attachment marks are not ignored for type conformance checks (with respect to VJAR/VBAR and related validity rules). | ||
Initialization | Validity rules are selectively checked. The initialization rule (VEVI) and the target rule (VUTA) are checked only for attached entities and attached call targets -- i.e., detachable cases are not checked. | ||
Transitional | Checking against all void-safety validity rules using some potentially unsafe CAPs, assuming that all assertions are satisfied, and ignoring some complex cases like passing incompletely initialized Current from a creation procedure or creating agents when Current is not completely initialized. | 13.11, 7.3 | |
Complete | Complete checking against all void-safety validity rules ignoring any unsafe CAPs. | 14.05 and more recent |
Discussion of compatibility issues
Eiffel Software and the wheels of progress
The Eiffel analysis, design, and programming language has remained relatively static since its original specification in the mid-1980's. However, periodically it has become necessary to make certain changes in order to make certain language improvements and to enable new facilities. It is the policy of Eiffel Software, when such changes are made, to ensure that the changes have minimum impact upon existing software. For some changes, that means no impact at all, but for others it means that the new Eiffel is incompatible with the old Eiffel (the so-called "breaking changes" … those changes that break existing code). And that means that existing software will have to be changed to take advantage of the recent changes to Eiffel. Even so, Eiffel Software has been able to ease the transition from old to new by implementing certain compatibility options which allow existing software still to run as in previous versions during periods of transition.
Sources of changes
The Eiffel programming language is standardized under the ISO and ECMA standardization organizations. So, it is not surprising that many of the changes that are implemented by Eiffel Software are driven by the work of the Eiffel standardization committee.
Still, the standard itself is a moving target, and there are always differences between what is in the current standard and what has been implemented by Eiffel Software. Also, only immediately after publication of the standard might there be complete agreement between the standard document itself and the perception of Eiffel by the standard committee. That is to say that a new version of the standard may be published once every few years, but the process of moving the language forward continues in the committee in the meantime.
The diagram below attempts to characterize the relationship among the various factors that define Eiffel.
It is easy to see the overlapping areas. The centermost represents that part of Eiffel that is at once implemented by Eiffel Software, exists in the current published version of the standard, and is anticipated to remain in the standard for the next version.
The other areas represent Eiffel features that are supported by only one or a combination of two of these factors.
Types of changes
There are many different types of changes that can effect existing code. Here are some examples of these.
- Changes to the Eiffel library classes
- Removal or obsoleting of classes or features. Example:
{SPECIAL}.make
is removed as void-unsafe. - Changing conformance. Example:
ARRAYED_LIST
no longer conforms toARRAY
. - Changing feature types. Example:
{ARRAYED_LIST}.count
and{ARRAYED_LIST}.area
were changed from attributes to functions.
- Removal or obsoleting of classes or features. Example:
- Language keyword changes
- A word that was once a keyword is no longer a keyword (potentially allowing the word to be used as an identifier, and affecting software using it as a keyword). Example:
indexing
is no longer a keyword. - A word that was not a language keyword in previous versions, becomes one in the current version (potentially breaking any code that used that word as an identifier). Example:
attached
- A keyword (or notation) used in a particular context is retired from that context in favor of a more appropriate keyword. (potentially affecting all software using the old keyword in that context). Example:
indexing
is retired in favor ofnote
. - The usage of an existing keyword in a new context (usually has no effect on existing software). Example:
as
used inattached
syntax for object test (in addition to its traditional role in therename
part of theinherit
clause.)
- A word that was once a keyword is no longer a keyword (potentially allowing the word to be used as an identifier, and affecting software using it as a keyword). Example:
- Language construct changes
- Addition of new constructs or extensions to existing constructs. Example: iteration form of the loop construct.
- Changes to existing constructs. Example: Object test syntax change:
attached {T} expr as u
versus{u: T} expr
- Removal of obsolete constructs.
Types of compatibility options
EiffelStudio and Eiffel compiler options
These "mode" options are selected when EiffelStudio is started up or when the command line Eiffel compiler is invoked. The following two mode options were introduced in version 6.3 on the eve of implementing void-safety as an integral feature of Eiffel. The mode options were intended to help developers deal with the changes to the Eiffel libraries for void-safety.
- -compat runs EiffelStudio or the Eiffel compiler in "compatibility mode" so that compilation will use libraries that are compatible with older versions of Eiffel.
- -experiment runs EiffelStudio or the Eiffel compiler in "experimental mode" so that compilation will use libraries based on an upcoming version of Eiffel.
Implicit here is that there is also a "default" mode which is invoked when neither of compatibility nor experimental mode is used. Default mode assumes a "current" set of libraries.
Also, implied by these modes is a progression of their meanings over time. That is, as time passes and language changes are reflected in Eiffel Software's products, the "experimental" mode of today will likely be the "default" mode of tomorrow. And the "default" mode of today may become the "compatible" mode of tomorrow.
Project settings
These options are set in the EiffelStudio Project Settings dialog box.
The most important of these is the Syntax level variant setting. You can choose among a set of syntax level variants that let you control how the compiler views certain language changes. So, for example, if you are compiling classes that contain obsolete keywords, you would set the Syntax setting to the Obsolete syntax variant.
Bear in mind that the detail meanings of the various syntax variants may change from version to version. So, it's a good idea periodically to check the syntax level variant settings by version.
Compatibility tools
The syntax updater
The syntax updater is located in the EiffelStudio "tools" folder. It is a command line utility that will update certain syntax elements from obsolete syntax to current syntax. The syntax updater was introduced with EiffelStudio version 6.4.
The tool makes the following updates to existing code:
- Replaces obsolete "
!!
" syntax withcreate
keyword syntax. - Replaces obsolete keyword
creation
withcreate
. - Removes obsolete keyword
is
after routine signatures. - Replaces obsolete keyword
is
in constants with "=
" (e. g., "i: INTEGER is 5
" becomesi: INTEGER = 5"
). - Replaces obsolete keyword
indexing
withnote
. - Replaces the June 2006 Standard object test syntax (e. g., "
{x: T} exp
") with the committee-approved provisional standard syntax (e. g., "attached {T} exp as x
"). - Replaces obsolete non-object feature call syntax with current syntax (e. g., "
feature {X}.f
" becomes "{X}.f
"). - Replaces attached and detachable type markers from June 2006 Standard with committee-approved provisional standard syntax (e. g., "
x: !T
" becomes "x: attached T
" and "x: ?T
" becomes "x: detachable T
").