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: 109fba,97482af7429a6a62 X-Google-Attributes: gid109fba,public X-Google-Thread: fc443,15f1992f9a196a0f,start X-Google-Attributes: gidfc443,public X-Google-Thread: 10a640,9ca80649c409e17e X-Google-Attributes: gid10a640,public X-Google-Thread: 1108a1,371d317eff97da58 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,97482af7429a6a62 X-Google-Attributes: gid103376,public From: matomira@di.epfl.ch (Fernando Mato Mira) Subject: Re: Multiple dispatch (was Re: C++ not OOP?) Date: 1995/04/19 Message-ID: <3n3hfq$8vm@disunms.epfl.ch>#1/1 X-Deja-AN: 101268181 distribution: world references: <3mbmd5$s06@icebox.mfltd.co.uk> <3mcfbf$psl@acmez.gatech.edu> <3mcoh6$add@Starbase.NeoSoft.COM> <3mdrpf$3o9@disunms.epfl.ch> <3mg45s$5r7@disunms.epfl.ch> <3mjc8c$630@crcnis3.unl.edu> <3n1als$ksi@no-names.nerdc.ufl.edu> content-type: text/plain; charset=iso-8859-1 organization: Ecole Polytechnique Federale de Lausanne mime-version: 1.0 newsgroups: comp.object,comp.lang.c++,comp.lang.ada,comp.lang.clos,comp.sys.sgi.graphics Date: 1995-04-19T00:00:00+00:00 List-Id: In article <3n1als$ksi@no-names.nerdc.ufl.edu>, kem@prl.ufl.edu (Kelly Murray) writes: > One could do it using a NO OBJECT DISPATCH too, using a two-dimensional > array where each shape and device is given a unique index. > Then we can define functions for each pairing filling the table > initially with default primitives. > > (defun draw (any-dev any-shape) > (funcall (aref *draw-table (device-index any-dev) > (shape-index any-shape)))) > > To add a device or shape, create a new index, and a bigger table. ^^^^^ There's a kind of two-level dispatch in IRIS Inventor (first one is a table lookup) because of C++'s limitations (eg: impossibility of adding virtuals to a class without access to its sources). -- F.D. Mato Mira http://ligwww.epfl.ch/matomira.html Computer Graphics Lab matomira@epfl.ch EPFL FAX: +41 (21) 693-5328