This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

Generic conformance in ISE Eiffel 4.3

(Adapted from a message posted to comp.lang.eiffel, 7 January 1998)

One of the important contributions of ISE Eiffel 4.3 in the language and compiler area is the resolution of the "generic conformance" issue.

Eiffel type rules (chapter 13 of "Eiffel: The Language", see http://eiffel.com/doc/page.html) specify that of the two types


	A [X]
	A [Y]

the second will conform to the first if and only if type Y conforms to type X. This is one of the very few areas of the language that was not properly supported by releases so far (simply because it is very difficult to implement). According to the implementation, conformance held whenever X and Y are reference types. (For basic expanded types, such as INTEGER and REAL, the rule was properly followed.)

As a result, an assignment attempt


    ax ?= ay

with ax of type A [X] and ay of type A [Y], was able to succeed (i.e. to yield a non-void ax) when it should not have.

This is corrected now and the rule is fully implemented. As noted, the implementation is difficult and has been a major effort.

The rule is of course recursive, e.g. (assuming SQUARE inherits from RECTANGLE and LINKED_LIST from LIST, with no other inheritance links between the classes involved, "->" used as abbreviation for "conforms to" and "-/>" for "does not conform to"):


   ARRAY [LIST [SQUARE]]             -> ARRAY [LIST [RECTANGLE]]
   ARRAY [LINKED_LIST [SQUARE]] -> ARRAY [LIST [SQUARE]]
   ARRAY [LINKED_LIST [SQUARE]] -> ARRAY [LIST [RECTANGLE]]

but


   ARRAY [LIST [SQUARE]] -/> ARRAY [LIST [POPSICLE]]
   ARRAY [LIST [SQUARE]] -/> LIST [LIST [SQUARE]]

This change has been requested by many large users and will simplify their software considerably, since they have had to work around the deficiency in the past, typically by adding an attribute that characterizes the actual generic derivation.

Other users have pointed out to us that their code actually took "advantage" of the bug to have assignment attempts that succeed even when they shouldn't. In such a case, the software will of course have to be amended to follow the correct language semantics.

We hope all users will greatly benefit from this and all the other advances of ISE Eiffel 4.3.