comp.lang.ada
 help / color / mirror / Atom feed
From: Fraser Wilson <newsfraser@blancolioni.org>
Subject: Re: OOD in Ada?
Date: 01 Jul 2002 13:50:14 +0200
Date: 2002-07-01T11:48:48+00:00	[thread overview]
Message-ID: <usn33u0p5.fsf@FWILSON.i-did-not-set--mail-host-address--so-shoot-me> (raw)
In-Reply-To: uhpui5mqejg73@corp.supernews.com

"Randy Brukardt" <randy@rrsoftware.com> writes:

> This is a fine solution, but it runs into a problem in use: essentially
> every reference to anything will need a type conversion to the "real"
> type in order to access the operations/components.

There's a certain amount of that, yes.  But most of the work is done
with dispatch: one subprogram does the semantic analysis, another does
the code generation, and most of the time you can make the call
without worrying about what the tree node really is (even if you
secretly know).

For example, an if statement node has an element called "Condition",
and when checking an if statement, a call like Check
(If_Statement.Condition) suffices.  You know and I know that it's
really an expression, but I don't have to encode that knowledge.  In
general, the parse tree has been able to avoid type conversions; the
other class hierarchies (symbol table entries and types) aren't so
pretty.

Dispatching operations on the root tree node type have to be carefully
chosen of course.  And that can get a bit silly: in the class
hierarchy for symbol table entries, one of the operations is
"Push_Address" which only makes sense for variables and subprograms,
so any time you call this operation you have to know what you have.
Perhaps a conversion is better in this case, to make that knowledge
explicit (since unlike the parse tree, it's being relied upon).

cheers,
Fraser.



  reply	other threads:[~2002-07-01 11:50 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-21 16:39 OOD in Ada? David Crocker
2002-06-21 17:20 ` Pat Rogers
2002-06-21 19:37   ` Ed Falis
2002-06-23  3:05   ` Ted Dennison
2002-06-23  7:03     ` tmoran
2002-06-24 21:41       ` Ted Dennison
2002-06-24 14:19     ` Stephen Leake
2002-06-21 17:22 ` Marin David Condic
2002-06-22  4:42 ` Jeffrey Carter
2002-06-22  9:18 ` Dr. Michael Paus
2002-06-22  9:47   ` Pascal Obry
2002-06-22 13:11     ` Dr. Michael Paus
2002-06-22 13:46       ` OOD in Ada? Correction Dr. Michael Paus
2002-06-22 18:21         ` Simon Wright
2002-06-28 23:57         ` Randy Brukardt
2002-07-09  8:45           ` Preben Randhol
2002-07-09 17:12             ` Mark Biggar
2002-07-09 19:40             ` Randy Brukardt
2002-06-23  3:33   ` OOD in Ada? steve_H
2002-06-23  4:55     ` Jim Rogers
2002-06-23  5:33       ` achrist
2002-06-25 18:00       ` Georg Bauhaus
2002-06-25 18:55         ` Marin David Condic
2002-07-07 18:19           ` Daniel Dudley
2002-06-23  7:46     ` Dr. Michael Paus
2002-06-24  5:06       ` steve_H
2002-06-23 19:26   ` Chad R. Meiners
2002-06-22 22:47 ` Dmitry A.Kazakov
2002-06-24 20:03 ` Kevin Cline
2002-06-25 13:32   ` David Crocker
2002-06-25 13:58     ` Marin David Condic
2002-06-26 18:16       ` tmoran
2002-06-26 18:47         ` Marin David Condic
2002-06-27 18:23           ` tmoran
2002-06-28 13:09             ` Marin David Condic
2002-06-26  0:59     ` Hyman Rosen
2002-06-26  4:57       ` Jim Rogers
2002-06-26 12:49       ` Marin David Condic
2002-06-26  9:01     ` Fraser Wilson
2002-06-29  0:08       ` Randy Brukardt
2002-07-01 11:50         ` Fraser Wilson [this message]
2002-07-05 20:02     ` Stephen J. Bevan
2002-07-09 19:19 ` Craig Carey
replies disabled

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