comp.lang.ada
 help / color / mirror / Atom feed
* Importance of Polymorphism
@ 1998-02-10  0:00 Nick Roberts
  1998-02-10  0:00 ` Brian Rogoff
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Roberts @ 1998-02-10  0:00 UTC (permalink / raw)



In a recent article <34DB9059.7E4E@mcc.com> (a wonderfully comprehensive
reply to a question about inheritance), Matthew Heaney (mheaney@ni.net)
states that the polymorphism which Ada 95 adds to Ada 83 is really just an
adjunct to the data abstraction facilities already there.

I'm not really disagreeing with him :-) -- the data abstraction is the
basis for all the other 'object-oriented' facilities -- but I do think that
there is a little more significance to the introduction of _dynamic_
polymorphism than just as an 'adjunct'.

It's the world's most contended subject, I get the impression, but my own
take on it is: I believe it is dynamic polymorphism which really defines
the _key_ advantage of object oriented programming.  It's perhaps not so
obvious in a compiled language such as Ada, especially where there is not
(yet) a culture of using dynamic polymorphism very heavily.

But, in a language, such as SmallTalk for example, in which objects are so
heavily used that, in practice, dynamic polymorphism becomes deeply imbued
in the language, its importance is easy to appreciate.  Try to remove it
from SmallTalk, and the whole language would completely fall down.  It just
wouldn't work.  In addition, I reckon dynamic polymorphism is the only
truly unique feature of object orientation; it has lots of other features,
but they can all be found in prior techniques.

In the future, it may well be that Ada gets rather like SmallTalk --
especially considering the fact that computers in the future are going to
be immensely powerful (even pocket organisers etc.).  Libraries will be
built on other libraries, stacked up many, many levels deep, and the use of
inheritance (rather than just wholesale redefinition) will become much more
prevalent.  At this point, dynamic polymorphism will start to become really
vital, as libraries are supplied in pre-compiled form (or where a total
rebuild could take weeks!).

-- 

== Nick Roberts ================================================
== Croydon, UK                       ===========================
==                                              ================
== Proprietor, ThoughtWing Software                   ==========
== Independent Software Development Consultant            ======
== Nick.Roberts@dial.pipex.com                              ====
== Voicemail & Fax +44 181-405 1124                          ===
==                                                            ==
==           I live not in myself, but I become               ==
===          Portion of that around me; and to me             ==
====         High mountains are a feeling, but the hum        ==
=======      Of human cities torture.
===========                             -- Byron [Childe Harold]





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Importance of Polymorphism
  1998-02-10  0:00 Importance of Polymorphism Nick Roberts
@ 1998-02-10  0:00 ` Brian Rogoff
  1998-02-10  0:00   ` Jon S Anthony
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Rogoff @ 1998-02-10  0:00 UTC (permalink / raw)



On 10 Feb 1998, Nick Roberts wrote:
> It's the world's most contended subject, I get the impression, but my own
> take on it is: I believe it is dynamic polymorphism which really defines
> the _key_ advantage of object oriented programming.  It's perhaps not so
> obvious in a compiled language such as Ada, especially where there is not
> (yet) a culture of using dynamic polymorphism very heavily.

Also a key disadvantage. No, I'm not saying that dynamic dispatch is bad
or evil, just that there are costs (which function am I really calling?, 
why do I have to have this tag on everything? etc...).

> In the future, it may well be that Ada gets rather like SmallTalk --

I hope we get block closures, or at least some limited closure facility, 
but I think Smalltalk style OO and Ada style OO (with static typing) won't 
mix well. More likely would be some Java interface type mechanism, and
maybe a limited form of multi-dispatch. We're already seeing a bit of this 
now in GNAT ("downward funargs" via Unrestricted_Access) and the
Intermetrics Java Mapping (pragma Convention( Java_Interface, ... ) ) but 
I doubt we'll see a "doesNotUnderstand" message at runtime soon :-).

-- Brian






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Importance of Polymorphism
  1998-02-10  0:00 ` Brian Rogoff
@ 1998-02-10  0:00   ` Jon S Anthony
  1998-02-10  0:00     ` Brian Rogoff
  0 siblings, 1 reply; 5+ messages in thread
From: Jon S Anthony @ 1998-02-10  0:00 UTC (permalink / raw)



Brian Rogoff <bpr@shell5.ba.best.com> writes:

> 
> On 10 Feb 1998, Nick Roberts wrote:
> > It's the world's most contended subject, I get the impression, but my own
> > take on it is: I believe it is dynamic polymorphism which really defines
> > the _key_ advantage of object oriented programming.  It's perhaps not so
> > obvious in a compiled language such as Ada, especially where there is not
> > (yet) a culture of using dynamic polymorphism very heavily.
> 
> Also a key disadvantage. No, I'm not saying that dynamic dispatch is bad
> or evil, just that there are costs (which function am I really calling?, 
> why do I have to have this tag on everything? etc...).

Yes, exactly.  However, inheritance per se' is probably the root of
all the "disadvantage" here, not so much simply dynamic dispatch.
Another way of saying this is that (class) inheritance based dd is
where such problems arise (with the attendant benefits of that
abstraction as well).

> > In the future, it may well be that Ada gets rather like SmallTalk --
> 
> I hope we get block closures, or at least some limited closure facility, 

Right.

> maybe a limited form of multi-dispatch. We're already seeing a bit of this 

Now this I would really like to see.  Well, to be fair, it would
really depend on what it ended up looking like.  If you could define
such operations outside the scope of their attendant type definitions,
that would really be handy (IMO) - but I really doubt that would happen.


/Jon

-- 
Jon Anthony
Synquiry Technologies, Ltd., Belmont, MA 02178, 617.484.3383
"Nightmares - Ha!  The way my life's been going lately,
 Who'd notice?"  -- Londo Mollari




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Importance of Polymorphism
  1998-02-10  0:00   ` Jon S Anthony
@ 1998-02-10  0:00     ` Brian Rogoff
  1998-02-12  0:00       ` Jon S Anthony
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Rogoff @ 1998-02-10  0:00 UTC (permalink / raw)



On 10 Feb 1998, Jon S Anthony wrote:
> Brian Rogoff <bpr@shell5.ba.best.com> writes:
> > Also a key disadvantage. No, I'm not saying that dynamic dispatch is bad
> > or evil, just that there are costs (which function am I really calling?, 
> > why do I have to have this tag on everything? etc...).
> 
> Yes, exactly.  However, inheritance per se' is probably the root of
> all the "disadvantage" here, not so much simply dynamic dispatch.
> Another way of saying this is that (class) inheritance based dd is
> where such problems arise (with the attendant benefits of that
> abstraction as well).

What else do you have in mind? Delegation is even more "spaghetti-like" as 
far as I can tell, though it also has advantages. 

> > maybe a limited form of multi-dispatch. We're already seeing a bit of this 
> 
> Now this I would really like to see.  Well, to be fair, it would
> really depend on what it ended up looking like.  If you could define
> such operations outside the scope of their attendant type definitions,
> that would really be handy (IMO) - but I really doubt that would happen.

Latest OOPSLA (97) has an article about adding some form of multi-dispatch
to Java. I haven't read it yet unfortunately, but there might be some
ideas relevant to Ada. At least Ada has the syntax right :-).

-- Brian





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Importance of Polymorphism
  1998-02-10  0:00     ` Brian Rogoff
@ 1998-02-12  0:00       ` Jon S Anthony
  0 siblings, 0 replies; 5+ messages in thread
From: Jon S Anthony @ 1998-02-12  0:00 UTC (permalink / raw)



Brian Rogoff <bpr@shell5.ba.best.com> writes:

> On 10 Feb 1998, Jon S Anthony wrote:
> > Yes, exactly.  However, inheritance per se' is probably the root of
> > all the "disadvantage" here, not so much simply dynamic dispatch.
> > Another way of saying this is that (class) inheritance based dd is
> > where such problems arise (with the attendant benefits of that
> > abstraction as well).
>
> What else do you have in mind? Delegation is even more
> "spaghetti-like" as far as I can tell, though it also has
> advantages.

Actually, I wasn't comparing CB dd for better/worse with any
comparable capability thing.  But dd is an orthogonal issue from the
problems of inheritance (what comes from where, etc.)

/Jon

-- 
Jon Anthony
Synquiry Technologies, Ltd., Belmont, MA 02178, 617.484.3383
"Nightmares - Ha!  The way my life's been going lately,
 Who'd notice?"  -- Londo Mollari




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-02-12  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-10  0:00 Importance of Polymorphism Nick Roberts
1998-02-10  0:00 ` Brian Rogoff
1998-02-10  0:00   ` Jon S Anthony
1998-02-10  0:00     ` Brian Rogoff
1998-02-12  0:00       ` Jon S Anthony

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