🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1259

Re: generic parameters

#1259
From: Bertrand Meyer
Date: Thu, 22 Dec 1988 02:25
30 lines
1805 bytes
In article <65745UH2@PSUVM>, UH2@PSUVM.BITNET (Lee Sailer) writes:
> (Quotation from previous message having to do with generic parameters)
>
>     I dunno Eiffel, but this looks enough like Simula that I'll give you
> the Simula answer 8-)
> 
>     In your example, the WINDOW class *does* inherit all of the
> attributes of TREE, including T.  When you create a new instance of
> WINDOW you must specify T, as in
> 
>     newW :- NEW WINDOW[T, other formal parameters of WINDOW].


	It may look like Simula but it isn't Simula. T is not an attribute
of TREE (the Eiffel term would be ``feature'') but stands for a type,
to be supplied in a declaration of an entity (variable) of type
TREE [something], e.g. TREE [INTEGER], TREE [WINDOW]. This concept of
generic type parameter to a class has no equivalent in Simula.
Its presence in Eiffel is what makes compile-time type checking possible
(as opposed to the run-time checking required in Simula and most other
O-O languages; the only significant exception I am aware of is Trellis-Owl).

	The class parameters of Simula have a different role: they
represent values to be supplied to an *instance* of the class at *run-time*
(not parameters to declare a variable at compile-time). The equivalent in
Eiffel is provided by arguments to the initialization procedure of the
class (called Create).

Bertrand Meyer
bertrand@eiffel.com
Technical Details
Message-ID: <1063@hub.ucsb.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!peregrine!elroy!ames!ucsd!ucsbcsl!bertrand
References: <1826@vlot.cs.vu.nl> <65745UH2@PSUVM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!peregrine!elroy!ames!ucsd!ucsbcsl!bertrand
From: bertrand@hub.ucsb.edu (Bertrand Meyer)
Newsgroups: comp.lang.eiffel
Subject: Re: generic parameters
Summary: Syntax can be deceptive
Message-ID: <1063@hub.ucsb.edu>
Date: 22 Dec 88 02:25:03 GMT
References: <1826@vlot.cs.vu.nl> <65745UH2@PSUVM>
Organization: University of California, Santa Barbara
Lines: 30