comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Multiple dispatch  (was Re: C++ not OOP?)
Date: 1995/04/21
Date: 1995-04-21T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.95Apr21102220@spectre.mitre.org> (raw)
In-Reply-To: 3mbmd5$s06@icebox.mfltd.co.uk

In article <D79o2K.K0o@nntpa.cb.att.com> ka@socrates.hr.att.com (Kenneth Almquist) writes:

 > Robert Eachus interpreted the example problem slightly differently than
 > I did.  I assumed that (1) the system might have to support shapes and
 > devices which were very different than those anticipated when the system
 > was designed and (2) to achieve adequate drawing speeds it is necessary
 > to do a fairly good job of adapting to the capabilities of the various
 > devices.  Under these assumptions, Robert's design no longer guarantees
 > the O(1) subroutine counts he intended.

    Hmmm.  I certainly agree with (1), I'll argure from practical
experience that my approach does deal with (2).  You just need a "rich"
enough set of optional primitives to cover the set of possible engines.

 > If a new shape is added, along with some devices which support an
 > operation specificly designed to support that shape, then to achieve
 > adequate efficiency (see assumption 2) it may be necessary to add a
 > new optional operation to Robert's design.

   Agreed, but this is not a limitation.  If you look at what you are
saying, it is that evolving requirements may result in an evolving
design.  But there is no need for massive restructuring in this
case--you add the new shape, and the "optional" primitive that you
need to define it, say Bessel functions, and a (base) implementation
in terms of other primitives.  At this point in Ada 95 you need to do
a "global" recompile because you have added a dispatching operation.
Then add each new device as usual.  Of course given the stated
assumptions you have additional work on each one because you want to
map the Bessel operation specially for each of these devices.

 > The problem I see with multiple dispatch is this:  Frequently it is
 > easy to express a high level description of a problem in terms of
 > multiple dispatch, but multiple dispatch normally requires you to
 > write too many routines.

   I totally agree.  During the Ada 9X development process, I actually
looked at the advantages and disadvantages of supporting multiple
dispatch.  It could have been done, but there are precious few cases
where the additional generality buys anything, and the educational
overhead is there forever.

 > The solution that I have been toying with is application specific
 > dispatch.  The idea is that you write the minimum number of
 > implementations of an abstract routine required to solve a problem,
 > and then develop an application-specific method of selecting which
 > implementation to call in a specific instance.  This minimizes the
 > number of instances at the cost of increasing the complexity of
 > determining which instance to call.

   Don't do that! ;-)  Seriously, in Ada the best way of satisfying
this need is with generic instantiation.  I can (and do) have a
library of several sorts with the same generic interface.  But rather
than letting some AI routine select the best one, I, as the designer,
choose the best sort for this application.

 > [1] It might be possible to write a program which read descriptions
 >     of the shapes and devices, and generate code to display each
 >     shape on each device.  Once this program was written, the
 >     programmer cost to implement a feature would be O(1).  My guess
 >     is that this approach is not very practical.

     Depends on your definition of practical.  It looks like a pretty
good description of how curses works, except that curses does it more
dynamically.


--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  parent reply	other threads:[~1995-04-21  0:00 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-04-02  0:00 Language Efficiency Robert C. Bethel
1995-04-04  0:00 ` Harold P Zbiegien
1995-04-04  0:00   ` Kennel
1995-04-05  0:00     ` Ray Toal
1995-04-07  0:00     ` Robert Dewar
     [not found]       ` <3m9o9q$igf@stc06.ctd.ornl.gov>
     [not found]         ` <D6ss6z.Gvw@mcshub.dcss.mcmaster.ca>
     [not found]           ` <dewar.797512974@gnat>
1995-04-19  0:00             ` Adam Beneschan
1995-04-19  0:00               ` Robert Dewar
     [not found]             ` <3mbmd5$s06@icebox.mfltd.co.uk>
1995-04-19  0:00               ` Multiple dispatch (was Re: C++ not OOP?) Robert I. Eachus
     [not found]               ` <D6uA77.Lqp@mcshub.dcss.mcmaster.ca>
     [not found]                 ` <dewar.797566928@gnat>
     [not found]                   ` <D6vxDG.JKJ@mcshub.dcss.mcmaster.ca>
     [not found]                     ` <dewar.797636710@gnat>
     [not found]                       ` <D6xF22.38H@mcshub.dcss.mcmaster.ca>
     [not found]                         ` <dewar.797729041@gnat>
     [not found]                           ` <3msdop$862@stc06.ctd.ornl.gov>
1995-04-19  0:00                   ` Language Efficiency Paul Graham
1995-04-19  0:00                     ` Robert Dewar
     [not found]                 ` <3mcfbf$psl@acmez.gatech.edu>
     [not found]                   ` <3mgnkc$e3j@atlantis <3muaif$46u@atlantis.utmb.edu>
     [not found]                     ` <3n0lsu$nio@druid.borland.com>
     [not found]                       ` <3n0uvi$8jt@atlantis.utmb.edu>
1995-04-19  0:00                         ` C++ not OOP? (Was: " Fernando Mato Mira
1995-04-19  0:00                           ` Curtis Bass
1995-04-19  0:00                             ` David Weller
1995-04-20  0:00                               ` Curtis Bass
1995-04-20  0:00                                 ` David Weller
1995-04-20  0:00                                   ` Robert Dewar
1995-04-21  0:00                                     ` Curtis Bass
1995-04-21  0:00                                       ` Robert Dewar
1995-04-20  0:00                                   ` Curtis Bass
1995-04-21  0:00                                     ` Robert Martin
1995-04-21  0:00                                       ` Ed Osinski
1995-04-21  0:00                                     ` Fernando Mato Mira
1995-04-21  0:00                                 ` Robert Martin
1995-04-20  0:00                         ` Matt Austern
1995-04-21  0:00                         ` Robert Martin
1995-04-21  0:00                           ` Curtis Bass
1995-04-21  0:00                         ` Matt Austern
1995-04-22  0:00                           ` David Weller
1995-04-22  0:00                           ` Robert Martin
1995-04-22  0:00                             ` OOAD courses by Object Mentor cjames
1995-04-21  0:00                         ` C++ not OOP? (Was: Language Efficiency Ed Osinski
1995-04-21  0:00                         ` Robert Martin
1995-04-21  0:00                           ` Curtis Bass
     [not found]                   ` <3mgnkc$e3j@atlantis.utmb.edu>
     [not found]                     ` <3mk65q$1kti@watnews1.watson.ibm.com>
     [not found]                       ` <3muavq$46u@atlantis.utmb.edu>
1995-04-21  0:00                         ` Norman H. Cohen
1995-04-21  0:00                           ` Curtis Bass
     [not found]                     ` <1995Apr13.180317.3308@rcmcon.com>
     [not found]                       ` <3muaif$46u@atlantis.utmb.edu>
1995-04-21  0:00                         ` Robert Martin
1995-04-21  0:00                           ` Curtis Bass
1995-04-21  0:00                             ` Robert Dewar
1995-04-22  0:00                             ` Robert Martin
     [not found]                   ` <3mcoh6$add@Starbase.NeoSoft.COM>
     [not found]                     ` <3mdrpf$3o9@disunms.epfl.ch>
     [not found]                       ` <dewar.797608300@gnat>
     [not found]                         ` <3mg45s$5r7@disunms.epfl.ch>
     [not found]                           ` <3mjc8c$630@crcnis3.unl.edu>
     [not found]                             ` <D71Gs9.2FG@nntpa.cb.att.com>
     [not found]                               ` <EACHUS.95Apr17162921@spectre.mitre.org>
     [not found]                                 ` <3n1als$ksi@no-names.nerdc.ufl.edu>
1995-04-19  0:00                                   ` Multiple dispatch (was Re: C++ not OOP?) Fernando Mato Mira
     [not found]                           ` <1995Apr13.152104@di.epfl.ch>
1995-04-21  0:00                             ` C++ not OOP? (Was: Language Efficiency James McKim
1995-04-19  0:00               ` Harley Davis
1995-04-19  0:00               ` Multiple dispatch (was Re: C++ not OOP?) Kenneth Almquist
     [not found]               ` <MATT.95Apr17124932@physics10.berkeley.edu>
     [not found]                 ` <3mujnl$4u8@atlantis.utmb.edu>
1995-04-20  0:00                   ` C++ not OOP? (Was: Language Efficiency ron house
1995-04-21  0:00                   ` Robert Martin
1995-04-21  0:00                     ` Curtis Bass
1995-04-21  0:00               ` Norman H. Cohen
1995-04-21  0:00                 ` Fernando Mato Mira
1995-04-21  0:00                   ` Erik Naggum
1995-04-21  0:00               ` Robert I. Eachus [this message]
     [not found]         ` <dewar.797469506@gnat>
     [not found]           ` <1995Apr10.095958@di.epfl.ch>
     [not found]             ` <dewar.797513130@gnat>
     [not found]               ` <1995Apr10.165638@di.epfl.ch>
     [not found]                 ` <D6yGqv.4BG@nntpa.cb.att.com>
1995-04-21  0:00                   ` Fergus Henderson
1995-04-22  0:00                     ` Kenneth Almquist
1995-04-19  0:00       ` Fergus Henderson
1995-04-19  0:00         ` Robert Dewar
1995-04-20  0:00           ` Kennel
1995-04-19  0:00             ` Robert Dewar
1995-04-04  0:00   ` Larry Kilgallen
1995-04-06  0:00     ` Robert Dewar
1995-04-20  0:00   ` Matt Austern
1995-04-21  0:00   ` Robert I. Eachus
1995-04-04  0:00 ` Bob Kitzberger
1995-04-05  0:00   ` Mike Wilson
1995-04-05  0:00     ` David Weller
1995-04-05  0:00     ` Larry Kilgallen
1995-04-05  0:00 ` Lawrence Free/ A.F. Software Services
1995-04-05  0:00 ` Mitch Gart
1995-04-06  0:00 ` Ken Leidner
1995-04-06  0:00   ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox