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,c52c30d32b866eae X-Google-Attributes: gidfac41,public X-Google-Thread: 1108a1,c52c30d32b866eae X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,2ea02452876a15e1 X-Google-Attributes: gid103376,public From: Laurent.Guerby@enst-bretagne.fr (Laurent Guerby) Subject: Re: Real OO Date: 1996/04/04 Message-ID: <4xivfflp93.fsf@leibniz.enst-bretagne.fr>#1/1 X-Deja-AN: 145830840 distribution: world sender: guerby@leibniz.enst-bretagne.fr references: <4jbmsk$uo5@watnews1.watson.ibm.com> content-type: text/plain; charset=US-ASCII organization: Telecom Bretagne mime-version: 1.0 newsgroups: comp.lang.ada,comp.lang.eiffel,comp.object Date: 1996-04-04T00:00:00+00:00 List-Id: Don Harrison writes : In case anyone is confused about how Eiffel's and Ada's parameter mechanisms : compare, the following hopefully summarizes them: [deleted] : Ada: : procedure f (a: A_TYPE) f (m); static : f (mc); dynamic : : But if f not defined in same spec: : f (m); static : f (mc); static What does "not defined in same spec" refer to ? [Ada question] [deleted] [thanks for this interesting list] : Conclusion: : : Ada: : - more efficient, but : - manual optimisation places a burden on developer : - reduced flexibility/reusability : - syntactically complex : : Eiffel: : - less efficient, but : - automatic optimisation means that the the efficiency gap is reduced as is : the burden on developer : - greater flexibility/reusability : - syntactically simple : : Don. - Efficiency/optimisation : your list shows that for most uses, the Ada programmer can _force_ a static binding. In the case of dynamic binding, the Ada compiler can do the same optimisation (not 100% sure of complete equivalence here ;-) than the Eiffel compiler. - flexibility : I don't know flexibility means weak compile-time checks here (ultimate flexibility is int and void * for this respect ;-). On the Ada side, you have 4 possibilities (at least, staying in the Ada/OOP world ;-) : X1 : Tagged_Type; X2 : Access_To_Tagged_Type; X3 : Tagged_Type'Class := Something_Not_Statically_Tagged; X4 : Access_To_Tagged_Type_Class; If you choose to use X1 or X2, you say to the compiler (and any source reader, human or not, "maintenability" feature) that X1 and X2.all are _exactly_ of type Tagged_Type (not in a subclass), since the tag never change for an Ada object. That's a semantic attribute, checked at compile time (in the Ada way ;-). To some extend, it's a "flexible" feature. If you use X3, you say to the compiler (idem) that you want a stack allocated "dynamically" (at elaboration time, no tag change after it) object somewhere in the Tagged_Type classes and subclasses. Note that the object will be "garbage collected" at the end of the declaration scope. If you use X4, you have complete "flexibility", and you have to use dynamic allocation with "new", or provided constructors. Note that you'll have to use Controlled types to provide portable "automatic" storage reclamation, or you'll have to buy a compiler supporting the 13.11.3 optional feature, widely known under the name "automatic garbage collection" ;). I don't know much of the Eiffel equivalent, as I'm far to be an Eiffel expert (but will be happy to learn more), I've just read a few years ago Bertrand Meyer's book. - reusability : I don't clearly see how the listed features have influence on reusability. Of course restricting the set of possible classes for a declared object "reduces" reutilisability, but if you code a reusable component in Ada, you'll certainly make great use of access to class wide types. - syntactically : That's of course a matter of state ("sugar" ;-). The Ada notation looks less "oopish", but has some advantage when dealing with symetric operators ("+", etc ...) as pointed out in other threads. [Don't trust 100% of what I say about OOP in Ada, since I haven't a great experience of OOP/Ada, please correct my mistakes if any in a constructive way]. -- -- Laurent Guerby, student at Telecom Bretagne (France), Team Ada -- "Use the Source, Luke. The Source will be with you, always (GPL)" -- http://www-eleves.enst-bretagne.fr/~guerby/ (GATO Project) -- Try GNAT, the GNU Ada 95 compiler (ftp://cs.nyu.edu/pub/gnat)