comp.lang.ada
 help / color / mirror / Atom feed
From: mab@dst17.wdl.loral.com (Mark A Biggar)
Subject: Re: No multiple dispatch in Ada95?
Date: 1995/04/06
Date: 1995-04-06T00:00:00+00:00	[thread overview]
Message-ID: <1995Apr6.163750.11289@wdl.loral.com> (raw)
In-Reply-To: 3lu8tp$eep@disunms.epfl.ch

In article <3lu8tp$eep@disunms.epfl.ch> matomira@di.epfl.ch (Fernando Mato Mira) writes:
>  I checked the reference manual. There's no multiple dispatching
>in Ada95?
>  I see no reason why a left-to-right disambiguating rule was not good enough.
>  You only add the extra dispatching complexity when the methods defined
>require it. And it should be faster than simulating it by
>a `double dispatch'. What's worse, time is already wasted checking
>for a Constraint_Error.

The major reason for leaving out multiple dispatch is that given
the limitations that would have to be put on it it would be practically
useless.  Note that the only dispatching operations in Ada95 are 
the primitive operation of the tagged type and those can only be
defined in the same package spec as the tagged type declaration itself
and even then only until you do something to freeze the type (like
derive another type from it).  So once you derive a new tagged type from
an old one you can now longer define dispatching operaton on the parent type.
This means that if, for example, I had tagged types A and B with new type
C derived from A and D derived from B and the multiple dispatching operator
F(A, B), then only new dispatching version I can define is F(C, D).  If
I define F(A, D) it wouldn't be dispatching on A and likewise F(C, B)
wouldn't be dispatching on B.  And even then all that would have to be
defined in the same package spec.  Basically adding multiple dispatch to 
the language would require redisigning the whole tagged type system.

>PS: And why not reaping the benefits of both single inheritance
>   and contract-based design by restricting inheritance to
>   only one parent with structure plus an arbitrary number of abstract
>   parents with null records?

That solves the duplicate data member problem but doesn't solve the duplicate
operation problem.

--
Mark Biggar
mab@wdl.loral.com






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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-04-05  0:00 No multiple dispatch in Ada95? Fernando Mato Mira
1995-04-06  0:00 ` Mark A Biggar [this message]
1995-04-07  0:00   ` Fernando Mato Mira
1995-04-07  0:00     ` Norman H. Cohen
1995-04-06  0:00 ` Tucker Taft
1995-04-07  0:00   ` Robert Dewar
1995-04-06  0:00 ` Robert Dewar
1995-04-07  0:00   ` Fernando D. Mato Mira
replies disabled

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