[comp.lang.eiffel] -> in

stabl@unipas.fmi.uni-passau.de (Robert Stabl) (07/11/89)

Hello,

I have a question about the Eiffel class "SORTED_LIST".

The definition of SORTED_LIST starts with the following line:
     class SORTED_LIST [ T -> COMPARABLE ] export ....
     
What does the '->' stand for?
What is the semantic of this (polymorphic) class definition?

Greetings
 Robert.
-- 
\  Robert Stabl              =|= stabl@unipas.fmi.uni-passau.de               /
 \ Dept. of Computer Science |=| stabl%unipas.fmi.uni-passau.de@unido.BITNET /
 / University of Passau      =|= stabl%unipas.fmi.uni-passau.de@relay.CS.NET \
/  West Germany              |=| Phone: +49 851/509-346                       \

bertrand@eiffel.UUCP (Bertrand Meyer) (07/14/89)

From <610@unipas.fmi.uni-passau.de> by stabl@unipas.fmi.uni-passau.de
(Robert Stabl):

> I have a question about the Eiffel [basic library] class "SORTED_LIST".
> 
> The definition of SORTED_LIST starts with the following line:
>      class SORTED_LIST [ T -> COMPARABLE ] export ....
>      
> What does the '->' stand for?

Since no one else seems to have answered let me explain.
This is ``constrained genericity'', which means that any actual
generic parameter used for the formal T generic parameter should be
a descendant of class COMPARABLE, that is to say equipped with
operations <=, <, > etc.

For some reason that I don't recall (probably just time constraints)
this important facility did not find its way into the book
``Object-Oriented Software Construction'' - more precisely,
chapter 19, ``Genericity versus Inheritance'', where it belongs.
The only glimpse of it is exercise 19.5, where it is discussed in the
conditional (``Consider the usefulness of an extension...'').

Constrained genericity is described in the 2.1 Eiffel User's Manual,
as well as in the new Eiffel Reference Manual distributed with 2.2.


-- Bertrand Meyer
bertrand@eiffel.com