comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Dynamic run-time
Date: 2000/04/03
Date: 2000-04-03T00:00:00+00:00	[thread overview]
Message-ID: <wccu2hj6nu1.fsf@world.std.com> (raw)
In-Reply-To: 38E3BAC4.FC400CA4@averstar.com

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




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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-30  0:00 Dynamic run-time xaplos
2000-03-30  0:00 ` Tucker Taft
2000-04-03  0:00   ` Robert A Duff [this message]
2000-04-04  0:00   ` Mats Weber
replies disabled

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