From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 19 Jul 93 14:32:30 GMT From: news.cnri.reston.va.us!newsserver.jvnc.net!louie!balin.cis.udel.edu!carro ll@uunet.uu.net (Mark C. Carroll) Subject: Re: OO Preprocessor for Ada Message-ID: <1993Jul19.143230.18648@udel.edu> List-Id: In article <15JUL199315464091@cl2.cl.uh.edu> RILEY@cl.uh.edu writes: >Thanks for the suggestions, but I still have a couple of questions: > >In article , stt@spock.camb.inmet.com (Tucker Taft) writes.. >>>>Here are some possible look and feel issues: >>>> >>>> 1) Prefix notation >>>> i.e. blah.operation(params) instead of operation(blah,params) >> >>However, this breaks down for binary operators. One nice >>feature of CLOS and Ada 9X, is that binary operators are handled >>symmetrically, without any need for non-inheritable "friends." > >How does Smalltalk handle binary operators? >I don't think it involves "friends". Smalltalk uses a trick called multiple dispatch. The idea is, you dispatch on the first parameter, which calls a method which selects one of a group of available methods, and dispatches one of those on the second parameter. Bad explanation. Let me use an example: a + b What this does is send the message "+" with the argument "b" to the object "a". Now, none of the types are known statically, so the compiler cannot select the correct method for adding an object of type "TypeOfA" to an object for type "TypeOfB". But "a" does know it's own type. So it dispatches again, using that information: the method "+" for object "a" dispatches again, and does: b addATypeA: a So you've dispatched twice: once on the type of A (in the method "+") and once on the type of b (in the method "addATypeA"). It's rather kludgy, but it does do what you need. But I think that multimethod binding (which if I'm reading things correctly Ada9x does) is prefereable. -- || Mark Craig Carroll: ||"I live to see my fondest dreams realized, || CIS Grad, Univ of Delaware || Of living under the sights and sounds of || PGP key available by finger || the gifted, Who gave so much to me" || carroll@udel.edu || - _Feed_the_Fire_, Happy Rhodes