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: jhd@herold.franken.de (Joachim Durchholz) Subject: Re: Real OO Date: 1996/05/07 Message-ID: <68P8IzIk3RB@herold.franken.de>#1/1 X-Deja-AN: 153799894 distribution: world references: <4j9p3a$uo5@watnews1.watson.ibm.com> newsgroups: comp.lang.eiffel,comp.lang.ada,comp.object Date: 1996-05-07T00:00:00+00:00 List-Id: ncohen@watson.ibm.com wrote 06.05.96 on Re: Real OO: > |> As I understand it, you mean the multiple dispatching mechanisms > |> (a.k.a. classwide operations). > > No, that's not what classwide operatins are. Ah, now some dark spots lighten up! > (By "discriminated union," we mean that for each value V of each type in > the class, there is a corresponding value in T'Class, and that the > corresponding value in T'Class includes a "tag" identifying the type of > the original value V.) In Eiffel, each value from a class is also considered a value of its ancestor classes. The language definition does not offer a discriminating tag. (However, some libraries have a feature that will return the dynamic type of an object at run-time; this could be used as a tag if needed.) > If you write a procedure > > procedure Q(X: in A'Class); > > it is not an operation of type A, so it is not inherited in the usual > sense by types derived from A. However, in a call, the actual parameter > may belong to A'Class, A, or any type descended from A. Unlike P, Q > never dispatches. In Eiffel you'd declare Q "frozen". This means you're not allowed to override it, effectively making it non-dispatching. > The body of Q must be written > in such a way that it depends only on properties common to all types in > the class. Same in Eiffel - when writing Q, no features from descendant classes are yet available. > THERE IS NO CLOS-LIKE > MULTIPLE DISPATCH IN ADA. Glad to hear that. Sorry for bashing the wrong language. > You CAN declare > > procedure S(X: in A'Class; Y: in B'Class); > > and this poses no problems. It does not dispatch. Well, Eiffel doesn't allow you to freeze parameter classes, so we have a point where Ada allows a bit more freedom. I can't comment on this yet - I'll have to revisit everything in this thread that had the words "class-wide" in it, which will take me some time... -Joachim -- Looking for a new job. Resume available on request.