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: 109fba,97482af7429a6a62 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,97482af7429a6a62 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,371d317eff97da58 X-Google-Attributes: gid1108a1,public X-Google-Thread: 10d15b,97482af7429a6a62 X-Google-Attributes: gid10d15b,public X-Google-Thread: 10a640,9ca80649c409e17e X-Google-Attributes: gid10a640,public From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: C++ not OOP? (Was: Language Efficiency Date: 1995/04/21 Message-ID: <3n8jdv$jer@watnews1.watson.ibm.com>#1/1 X-Deja-AN: 101368869 distribution: world references: <3mbmd5$s06@icebox.mfltd.co.uk> organization: IBM T.J. Watson Research Center reply-to: ncohen@watson.ibm.com newsgroups: comp.object,comp.lang.c++,comp.lang.ada,comp.lang.cobol,comp.lang.clos Date: 1995-04-21T00:00:00+00:00 List-Id: In article , davis@ilog.fr (Harley Davis) writes: |> Start with an abstract interface to devices. Write routines for all |> shapes which use this abstract interface. Then, for speed critical |> shape/device pairs, write more specific multimethods which use |> underlying device implementation information for optimization. |> Indeed, I believe this is the textbook approach to using multimethods. Yes, this is a far more compelling argument. Of course this approach should only be used with one's eyes wide open about the tradeoff between efficiency and maintainability: If the implementation of a device is changed, it is no longer sufficient to modify the method providing the standard interface. You have to (1) track down and (2) modify each of the specific multimethods. (1) is the hard part, since an interim solution for (2) is just to delete the specialized multimethod and revert to the general method. It should be noted that even in languages without direct linguistic support for multiple dispatch, the same effect can be achieved in a straightforward way by redispatching. -- Norman H. Cohen ncohen@watson.ibm.com