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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC 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: 1108a1,953e1a6689d791f6 X-Google-Attributes: gid1108a1,public X-Google-Thread: fdb77,953e1a6689d791f6 X-Google-Attributes: gidfdb77,public X-Google-Thread: f79bb,953e1a6689d791f6 X-Google-Attributes: gidf79bb,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public From: shang@corp.mot.com (David L. Shang) Subject: Re: Eiffel and Java Date: 1996/11/04 Message-ID: <1996Nov4.140227.4601@schbbs.mot.com>#1/1 X-Deja-AN: 194501325 sender: news@schbbs.mot.com (SCHBBS News Account) references: <55ditr$pnh@gaia.ns.utk.edu> organization: MOTOROLA reply-to: shang@corp.mot.com newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.sather,comp.lang.java.advocacy,comp.object Date: 1996-11-04T00:00:00+00:00 List-Id: In article <55ditr$pnh@gaia.ns.utk.edu> mbk@caffeine.engr.utk.edu (Matt Kennel) writes: > David L. Shang (shang@corp.mot.com) wrote: > : But Sather's superclass construction is limited to non-parametrerized > : classes only. > > This isn't true, at least in 1.1. The following compiles and executes. > > ------------------------------------------------------- > -- demonstrate abstract superclass over a parameterized type. > ------------------------------------------------------- > abstract class $OVER{T} > $P{T} is > feature1(arg:T); > end; > > abstract class $P{T} is > feature1(arg:T); > feature2(arg:T); > end; > > class CONCRETE{T} < $OVER{T} is > feature1(arg:T) is #OUT + "In feature\n"; end; > create:SAME is return new; end; > end; > > > class MAIN is > main is > #OUT + "Hello World.\n"; > > ob :$OVER{INT} := #CONCRETE{INT}; > ob.feature1(42); > > end; > end; > Try the following, if Sather's compiler does not complain, then, Sather's generic class is equivalent to Transframe's: class MAIN is main is #OUT + "Hello World.\n"; ob :$OVER; if (some_input_condition) ob := #CONCRETE{INT}; else ob = #P(STRING); // at this point, we don't know the exact element type of ob // type assurance must be used assume (typeof(ob).ElementType is INT) ob.feature1(42); end; > : Transframe provides a more powerful superclass construction that > : can support parameterized classes. > > : Suppose we have two existing classes > : .... > > I believe that Sather could express the same concept. > The concept of generic class in Sather is different than Transframe's. David Shang