From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Eiffel and Java + Ada dispatching Date: 1996/11/13 Message-ID: #1/1 X-Deja-AN: 196220656 references: organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.eiffel,comp.lang.ada Date: 1996-11-13T00:00:00+00:00 List-Id: In article , Don Harrison wrote: >:>generic class X [T -> Some_Type] ... >:> type Some_Type is tagged limited private; >:>package X ... >: >:I meant "type Some_Type is new Other_Type with private". > >Okay. What's the difference? In the first example above, Some_Type doesn't have any primitive operations. You can't do much of anything with it, other than declare objects and a few other minor things. (Unless you pass in explicit operations, which is what you (or somebody else?) was objecting to, several messages ago.) In the second example, Some_Type inherits all the primitive operations of Other_Type. Inside the generic, you can do dispatching calls to them and so forth. The actual type is required to be in the right class (Other_Type'Class), and thus implements all of those things you're calling. I believe Eiffel has something similar to both, but I forget the syntax. Is this the "class X [Some_Type]" vs. "class X [Some_Type -> Other_Type]" thing? You can have a generic class where the formal can be any class, or you can require the formal to be a subclass of some particular class. - Bob