comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: C/C++ programmer giving Ada95 a chance -- writing an emulator.
Date: 2000/03/29
Date: 2000-03-29T00:00:00+00:00	[thread overview]
Message-ID: <8bsmki$f0q$1@nnrp1.deja.com> (raw)
In-Reply-To: aBfE4.2740$AW1.181200@bgtnsc05-news.ops.worldnet.att.net

In article
<aBfE4.2740$AW1.181200@bgtnsc05-news.ops.worldnet.att.net>,
  "James S. Rogers" <jimmaureenrogers@worldnet.att.net> wrote:

> Although the original author of this thread used the term
> dispatching, his description of what he wants does not really
> want dispatching.

I disagree. Yes, he does not know to think at that abstraction
level, but it is completely appropriate to his problem.

> He wants to execute a procedure associated with a particular
> opcode value, not based upon a separate type.

But dynamic polymorphism is all about associating types with
values, and having separate types for the different opcodes
would likely give a far clearer, higher level, more abstract,
and just as efficient expression of his intent.

> He also did not want to use any form of
> case statement to determine the procedure to execute. This
> rules out the
> use of a discriminated record.

Now one can ask *why* he did not want to use a case statement,
and the answer has nothing to do with case statements, but
rather with thoughts about how they are likely implemented.

Note that access to procedures could perfectly well be
implemented using case statements, and indeed such an
implementation would be attractive in a safety critical
environment where indirect calls are not permitted at the
object level.

Equally case statements are typically implemented using indirect
jumps and may well be much more efficient than the use of
access to procedures.

> Show me how you will design a hierarchy of tagged types
> differentiated only by  values of discrete type. I have not
> yet seen that trick.

Not clear what you mean at all here. The point is to replace
the "values of discrete type" by not a hierarchy, but rather
a flat tree of subtypes.

What we have here is a classic case of confusing

  1. high level abstract design
  2. low level language solutions
  3. concern about efficiency of generated code

All three are quite valid in context, but often you find
people worrying about 3. when they should be worrying about 1.

We really can't tell what the right advice is in this situation
because all we are presented with is a low level solution and
associated (but slightly bogus) concerns with efficiency. We
really have no idea what the high level problem is. It might
or might not be the case that the use of tagged types is an
improvement (there are plenty of cases where tagged types and
OO stuff in general is horribly abused after all)


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




  reply	other threads:[~2000-03-29  0:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <38e148e2.5089627@news.shreve.net>
2000-03-28  0:00 ` C/C++ programmer giving Ada95 a chance -- writing an emulator Juergen Pfeifer
2000-03-28  0:00   ` Jim Rogers
2000-03-29  0:00     ` Ed Falis
2000-03-29  0:00       ` James S. Rogers
2000-03-29  0:00         ` Robert Dewar [this message]
2000-03-29  0:00         ` Jean-Marc Bourguet
2000-03-30  0:00         ` Geoff Bull
2000-03-30  0:00           ` tmoran
2000-04-01  0:00           ` Robert Dewar
2000-03-28  0:00 ` Geoff Bull
2000-03-28  0:00   ` Jean-Marc Bourguet
2000-03-28  0:00 ` Ken Garlington
     [not found] ` <38e19656.17008608@news.shreve.net>
2000-03-29  0:00   ` Marin D. Condic
2000-03-29  0:00   ` swhalen
2000-03-29  0:00     ` Robert Dewar
2000-03-30  0:00       ` swhalen
2000-03-29  0:00   ` Marc A. Criley
2000-03-29  0:00   ` David Starner
2000-03-29  0:00     ` Robert Dewar
2000-03-29  0:00       ` Marin D. Condic
2000-03-29  0:00         ` Robert A Duff
2000-03-29  0:00           ` Marin D. Condic
2000-03-29  0:00       ` Jean-Marc Bourguet
2000-03-29  0:00         ` Robert Dewar
2000-03-30  0:00           ` Jean-Marc Bourguet
2000-04-01  0:00             ` Robert Dewar
2000-03-30  0:00       ` Geoff Bull
2000-04-01  0:00         ` Robert Dewar
2000-04-02  0:00           ` Geoff Bull
2000-04-02  0:00             ` swhalen
2000-04-02  0:00             ` Robert Dewar
2000-03-29  0:00     ` Robert A Duff
2000-03-30  0:00       ` Geoff Bull
2000-04-01  0:00         ` Robert Dewar
2000-03-30  0:00   ` Samuel T. Harris
2000-04-01  0:00     ` Robert Dewar
2000-04-05  0:00       ` Robert A Duff
2000-03-30  0:00   ` Ken Garlington
2000-03-30  0:00 ` Geoff Bull
     [not found]   ` <38e7e951.8384503@news.shreve.net>
2000-04-02  0:00     ` Jean-Pierre Rosen
2000-04-02  0:00       ` Robert Dewar
2000-04-03  0:00         ` Paul Graham
2000-04-06  0:00           ` Robert Dewar
2000-04-06  0:00             ` Larry Kilgallen
2000-04-06  0:00               ` Robert Dewar
2000-04-06  0:00                 ` Gautier
2000-04-07  0:00                   ` Robert Dewar
2000-04-07  0:00                     ` Gautier
     [not found] <38E3DBD7.27F5B246@acenet.com.au>
2000-03-31  0:00 ` tmoran
2000-03-31  0:00   ` Geoff Bull
2000-04-01  0:00     ` Tucker Taft
2000-04-02  0:00       ` Robert Dewar
2000-04-02  0:00         ` Geoff Bull
2000-04-02  0:00       ` Geoff Bull
replies disabled

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