comp.lang.ada
 help / color / mirror / Atom feed
From: Ehud Lamm <mslamm@mscc.huji.ac.il>
Subject: Re: OO puzzle
Date: 1999/12/23
Date: 1999-12-23T00:00:00+00:00	[thread overview]
Message-ID: <83sqht$5oi$1@nnrp1.deja.com> (raw)
In-Reply-To: 83qtap$pri$1@nnrp1.deja.com

In article <83qtap$pri$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> In article
> <Pine.A41.3.96-heb-2.07.991222103646.28794B-
100000@pluto.mscc.huji.ac.il
> Well, I'll assume in Ada you would be talking about a routine that
> takes in driver'class and also has a "motor_vehicle" parameter on
which
> it dispatches, and it does *not* dispatch on the driver. One
possibility
> would be to have truck's version of register_driver internally check
> that the driver is in truck_driver'class:
>
> if d not in truck_driver'class then
>    raise Constraint_Error;
> end if;
>

Right. But than we are dealing with a runtime check. See the discussion
per Tucker's post.

> Another would be to disallow calls to the original register altogether
> (via "abstract" perhaps?) and to make a new one that only takes in
> truck_driver'class. That looses the dynamic dispatch from
> Motor_Vehicle'class, though.

But than you lose the ability to define the abstract interface (for
Motor_Vehicle) and know that it is supported by all descendants.

Trade offs all arround...

--
Ehud Lamm mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm
Check it out and subscribe to the E-List


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~1999-12-23  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-22  0:00 OO puzzle Ehud Lamm
1999-12-22  0:00 ` Ted Dennison
1999-12-23  0:00   ` Ehud Lamm [this message]
1999-12-23  0:00     ` Ted Dennison
1999-12-25  0:00       ` Ehud Lamm
1999-12-23  0:00     ` Robert A Duff
1999-12-25  0:00       ` Ehud Lamm
1999-12-22  0:00 ` Tucker Taft
1999-12-23  0:00   ` Ehud Lamm
1999-12-23  0:00     ` Robert Dewar
1999-12-23  0:00       ` Ehud Lamm
1999-12-24  0:00         ` swhalen
1999-12-25  0:00           ` Ehud Lamm
1999-12-25  0:00         ` Ehud Lamm
1999-12-29  0:00     ` Brian Rogoff
1999-12-30  0:00       ` Jeffrey L Straszheim
1999-12-31  0:00         ` Brian Rogoff
1999-12-31  0:00           ` Jeffrey L Straszheim
2000-01-02  0:00             ` Brian Rogoff
2000-01-03  0:00             ` Matthew Heaney
1999-12-22  0:00 ` Jeff Carter
replies disabled

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