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,c52c30d32b866eae X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,2ea02452876a15e1 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,c52c30d32b866eae X-Google-Attributes: gid1108a1,public From: donh@syd.csa.com.au (Don Harrison) Subject: Re: Real OO Date: 1996/05/07 Message-ID: #1/1 X-Deja-AN: 153450458 sender: news@assip.csasyd.oz references: <4mls4h$sau@watnews1.watson.ibm.com> organization: CSC Australia reply-to: donh@syd.csa.com.au newsgroups: comp.lang.eiffel,comp.lang.ada,comp.object Date: 1996-05-07T00:00:00+00:00 List-Id: Norman H. Cohen lectures Joachim (but in doing so provides a good summary of classwide operations): :In article <6850x6pV3RB@herold.franken.de>, :jhd@herold.franken.de (Joachim Durchholz) writes: : :|> As I understand it, you mean the multiple dispatching mechanisms :|> (a.k.a. classwide operations). : :No, that's not what classwide operatins are. Your post reflects a number :of misconceptions. Just one: that classwide operations are multiply dispatching. [...] Translating the examples into equivalent Eiffel (my additions in brackets), :If you write a procedure [in the same interface as A] : : procedure P(X: in A); class A feature p is ... -- X = Current :... If you write a procedure [anywhere] : : procedure Q(X: in A'Class); class A feature frozen q is ... -- X = Current, or class SOME_OTHER_CLASS feature q (x: A) is ... : procedure R(X: in A; Y: in B); [where A, B and R are in same interface] (It's syntactically impossible in Eiffel for an operation to be declared in two different classes). :--which would appear to be a procedure that dispatches based on both the :tag of X (identifying a type in the class rooted at A) and the tag of Y :(identifying a type in the class rooted at B). THERE IS NO CLOS-LIKE :MULTIPLE DISPATCH IN ADA. You CAN declare : : procedure S(X: in A'Class; Y: in B'Class); [anywhere] class A feature frozen q (y: B) is ... -- X = Current, or class B feature frozen q (x: X) is ... -- Y = Current, or class SOME_OTHER_CLASS feature frozen q (x: X; y: B) is ... [...] :It is also possible to write [in the same interface as A] : : procedure T(X:in A; Y: in B'Class); The addition of 'in' protects X from update. ... class SOME_OTHER_CLASS feature frozen q (x: X; y: B) is do ... ensure x = old x y = old y end [...] As the equivalent Eiffel shows, the term 'classwide operation' is misleading. An operation may be dispatching WRT one parameter but classwide WRT another. It is more accurate to speak of classwide operands rather than classwide operations. :-- :Norman H. Cohen ncohen@watson.ibm.com -- /// Don. (o o) =-=-=-=-=-=-=-=oOO=-(_)-=OOo=-=-=-=-=-=-=-=-