comp.lang.ada
 help / color / mirror / Atom feed
* Dynamic run-time
@ 2000-03-30  0:00 xaplos
  2000-03-30  0:00 ` Tucker Taft
  0 siblings, 1 reply; 4+ messages in thread
From: xaplos @ 2000-03-30  0:00 UTC (permalink / raw)


Does Ada provide an equivalent way of realizing the dynamic behavior
that SmallTalk or Objective-C provides? For instance is there a datatype
like Objective-C's id that allows variables and methods to be
dynamically bind at run-time?


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




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

* Re: Dynamic run-time
  2000-03-30  0:00 Dynamic run-time xaplos
@ 2000-03-30  0:00 ` Tucker Taft
  2000-04-03  0:00   ` Robert A Duff
  2000-04-04  0:00   ` Mats Weber
  0 siblings, 2 replies; 4+ messages in thread
From: Tucker Taft @ 2000-03-30  0:00 UTC (permalink / raw)


xaplos@my-deja.com wrote:
> 
> Does Ada provide an equivalent way of realizing the dynamic behavior
> that SmallTalk or Objective-C provides? For instance is there a datatype
> like Objective-C's id that allows variables and methods to be
> dynamically bind at run-time?

Not really.  Using tagged types you can do the kind of dynamic binding
that exists in C++ or Eiffel, but not the kind of "very dynamic" binding
that you can do in SmallTalk.  The upside is that in Ada you will
never get a "message not understood."  The downside is that you
can't read in from a terminal or equivalent the name of a function
or variable and somehow find and use the named entity.  

It is possible to do things like this using a symbolic debugger, of
course, and it is possible to build tools that process the
debug tables created by the compiler and make those tables available
at run-time to the program.  This is a fair amount of work, but
I have seen it used in an Ada-based object-oriented database manager
(for a somewhat different purpose).

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




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

* Re: Dynamic run-time
  2000-03-30  0:00 ` Tucker Taft
@ 2000-04-03  0:00   ` Robert A Duff
  2000-04-04  0:00   ` Mats Weber
  1 sibling, 0 replies; 4+ messages in thread
From: Robert A Duff @ 2000-04-03  0:00 UTC (permalink / raw)


Tucker Taft <stt@averstar.com> writes:

> xaplos@my-deja.com wrote:
> > 
> > Does Ada provide an equivalent way of realizing the dynamic behavior
> > that SmallTalk or Objective-C provides? For instance is there a datatype
> > like Objective-C's id that allows variables and methods to be
> > dynamically bind at run-time?
> 
> Not really.  Using tagged types you can do the kind of dynamic binding
> that exists in C++ or Eiffel, but not the kind of "very dynamic" binding
> that you can do in SmallTalk.  The upside is that in Ada you will
> never get a "message not understood."  The downside is that you
> can't read in from a terminal or equivalent the name of a function
> or variable and somehow find and use the named entity.  

I once wrote a program that needed more dynamic dispatching than Ada's
tagged types provide -- more along the lines of Smalltalk.  So I wrote a
generic package that kept track of tables of access-to-subprogram
values.  The tables were initialized at elaboration time, and after that
everything was quite efficient.  It wasn't that hard -- a couple or
three hundred lines of generics, as I recall.

Normally, however, I wouldn't do that.  As Tucker pointed out,
the built-in dispatching calls using Ada's tagged types provide a huge
advantage in that you always dispatch to something that really does
exist.

- Bob




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

* Re: Dynamic run-time
  2000-03-30  0:00 ` Tucker Taft
  2000-04-03  0:00   ` Robert A Duff
@ 2000-04-04  0:00   ` Mats Weber
  1 sibling, 0 replies; 4+ messages in thread
From: Mats Weber @ 2000-04-04  0:00 UTC (permalink / raw)


Tucker Taft wrote:

> Not really.  Using tagged types you can do the kind of dynamic binding
> that exists in C++ or Eiffel, but not the kind of "very dynamic" binding
> that you can do in SmallTalk.  The upside is that in Ada you will
> never get a "message not understood."  [...]

Well, you can get Constraint_Error instead of "message not understood",
see Ada RM 3.9.2(16).




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

end of thread, other threads:[~2000-04-04  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-30  0:00 Dynamic run-time xaplos
2000-03-30  0:00 ` Tucker Taft
2000-04-03  0:00   ` Robert A Duff
2000-04-04  0:00   ` Mats Weber

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