From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: Ada OO Mechanism
Date: 1999/06/09
Date: 1999-06-09T00:00:00+00:00 [thread overview]
Message-ID: <Pine.BSF.4.10.9906091950430.7012-100000@shell5.ba.best.com> (raw)
In-Reply-To: <375E92CB.27850620@averstar.com
On Wed, 9 Jun 1999, Tucker Taft wrote:
> Brian Rogoff wrote:
> > ...
> > This kind of problem is solved in some languages, like Common Lisp and
> > Dylan, with multiple value return and others, like ML and Haskell, with
> > tuples. Was the prospect of such a mechanism for Ada considered (yes I'm
> > sure :-) and if so why was it rejected? Seeing as Ada has aggregates, it
> > seems to me that multiple value return would also have been a feature.
>
> In Ada, multiple value return is not significantly different
> from returning a record. However, the problem we are trying
> to solve is not multiple value return, but rather returning
> objects of size unknown at compile-time without using the heap.
Yes, I know. I can understand why it makes sense that a record cannot
contain unconstrained types, but I don't understand why a suitable
generalization of Ada's ability to return unconstrained types could not be
made to solve the problem being discussed *without* forcing a heap based
mechanism on Ada. An example might be returning two strings on the stack.
> Common Lisp, Dylan, ML, and Haskell all rely heavily on heap-based
> mechanism, and what is passed around are references (or tuples
> of references).
It was an unfortunate choice of example languages, but I think you'll
agree that the reliance on the heap is mostly an implementation issue, at
least in the case of ML (*). Sorry for the confusion, I just don't know of
any system programming languages with multiple value return.
Incidentally, I'm not suggesting that this would be a good idea for Ada, I
am just interested in whether it was discussed and if so what were the
reasons for not doing it. I can think of a few myself...
> References, and records or arrays of references,
> are no problem in Ada either. The challenge is to avoid the heap,
> and I believe Ada goes further than almost any language in accomplishing
> that. But as pointed out, there are some limitations, which result
> in the heap being necessary when things get too complicated.
Agreed.
> > Using access params here to simulate functions with out params looks really
> > ugly to me.
>
> Access parameters are the Ada 95 way to give functions "out" parameters.
> It has the advantage of making the OUT parameters quite visible, thanks
> to the use of 'Access at the call point. Note that many languages don't
> support OUT parameters at all. All they support is passing references.
Sure, in C I don't mind doing this, but when I write Ada my "Ada mindset"
is such that this seems like a "workaround". If it really was a good idea
to make out parameters visible then I'd imagine I should always use
'Access since (as Robert Dewar likes to point out) we should favor the
reader and maintenance programer over the writer. That doesn't mean that
I won't often do this, just that unless I had a very good reason for
avoiding heap access I'd use one of the other workarounds.
-- Brian
(*) There are ML compilers which don't use garbage collectors, relying on
a technique called region inference which (roughly speaking) use a
mark-release style allocator with mark and release points inferred
automatically.
Its also true that Ada's avoidance of the heap is also implementation
dependent. Ada=>JVM compilers probably hit the heap quite a bit :-).
next prev parent reply other threads:[~1999-06-09 0:00 UTC|newest]
Thread overview: 116+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-20 0:00 Ada OO Mechanism Shawn M. Root
1999-05-20 0:00 ` Samuel Mize
1999-05-20 0:00 ` David Botton
1999-05-20 0:00 ` Samuel Mize
1999-05-20 0:00 ` David Botton
1999-05-24 0:00 ` Hyman Rosen
1999-05-24 0:00 ` Robert Dewar
1999-05-24 0:00 ` Hyman Rosen
1999-05-24 0:00 ` Mike
1999-05-25 0:00 ` Robert Dewar
1999-05-24 0:00 ` David Starner
1999-05-24 0:00 ` bob
1999-05-24 0:00 ` David Starner
1999-05-25 0:00 ` Ole-Hjalmar Kristensen
1999-05-25 0:00 ` Florian Weimer
1999-05-25 0:00 ` Mark A Biggar
1999-05-25 0:00 ` Hyman Rosen
1999-05-25 0:00 ` Richard D Riehle
1999-05-25 0:00 ` David Botton
1999-05-26 0:00 ` Tom Moran
1999-05-27 0:00 ` Aidan Skinner
1999-05-25 0:00 ` Samuel Mize
1999-05-25 0:00 ` Hyman Rosen
1999-05-25 0:00 ` Samuel Mize
1999-05-25 0:00 ` Chris
1999-05-25 0:00 ` David Botton
1999-05-27 0:00 ` Aidan Skinner
1999-05-27 0:00 ` Gautier
1999-05-27 0:00 ` Samuel Mize
1999-05-25 0:00 ` Brian Rogoff
1999-05-25 0:00 ` Jim
1999-05-26 0:00 ` Robert Dewar
1999-05-26 0:00 ` Brian Rogoff
1999-05-25 0:00 ` Richard D Riehle
1999-05-25 0:00 ` Hyman Rosen
1999-05-26 0:00 ` Ray Blaak
1999-05-26 0:00 ` Richard D Riehle
1999-05-26 0:00 ` Hyman Rosen
1999-05-27 0:00 ` Richard D Riehle
1999-06-05 0:00 ` Matthew Heaney
1999-06-07 0:00 ` Hyman Rosen
1999-05-28 0:00 ` Laurent Guerby
1999-06-05 0:00 ` Matthew Heaney
1999-06-07 0:00 ` Hyman Rosen
1999-06-08 0:00 ` Matthew Heaney
1999-06-08 0:00 ` Hyman Rosen
1999-06-08 0:00 ` Samuel Mize
1999-06-08 0:00 ` Hyman Rosen
1999-06-08 0:00 ` Robert Dewar
1999-06-08 0:00 ` Stanley R. Allen
1999-06-08 0:00 ` Markus Kuhn
1999-06-08 0:00 ` Stanley R. Allen
1999-05-26 0:00 ` Hyman Rosen
[not found] ` <t7zp2sr6yf.fsf@calumny.jyacc.c <t7emjmmx8w.fsf@calumny.jyacc.com>
1999-06-08 0:00 ` Larry Kilgallen
1999-06-08 0:00 ` Hyman Rosen
1999-06-08 0:00 ` Tucker Taft
1999-06-08 0:00 ` Brian Rogoff
1999-06-09 0:00 ` Tucker Taft
[not found] ` < <375E92CB.27850620@averstar.com>
1999-06-09 0:00 ` Brian Rogoff [this message]
1999-06-14 0:00 ` Robert A Duff
1999-06-09 0:00 ` Robert Dewar
1999-06-09 0:00 ` Samuel Mize
1999-06-09 0:00 ` Matthew Heaney
[not found] ` <t7zp2sr6yf.fsf@calumny.jyacc.c <t7r9nmz8ou.fsf@calumny.jyacc.com>
1999-06-08 0:00 ` Larry Kilgallen
1999-06-08 0:00 ` Hyman Rosen
1999-06-14 0:00 ` Robert A Duff
[not found] ` <t7zp2sr6yf.fsf@calumny.jyacc.c <375d9a3d.e1cccc63@averstar.com>
1999-06-09 0:00 ` Larry Kilgallen
1999-06-09 0:00 ` Tucker Taft
1999-05-27 0:00 ` Samuel Mize
1999-05-27 0:00 ` Hyman Rosen
1999-05-28 0:00 ` Laurent Guerby
1999-05-28 0:00 ` Richard D Riehle
1999-05-28 0:00 ` Tom Moran
1999-05-28 0:00 ` Samuel Mize
1999-05-27 0:00 ` Samuel Mize
1999-05-27 0:00 ` Jon S Anthony
1999-05-28 0:00 ` Robert I. Eachus
1999-05-28 0:00 ` Brian Rogoff
1999-05-29 0:00 ` Ehud Lamm
1999-05-30 0:00 ` chris
1999-05-30 0:00 ` Robert Dewar
1999-05-30 0:00 ` Harry George
1999-05-30 0:00 ` Vladimir Olensky
1999-05-31 0:00 ` Robert Dewar
1999-05-31 0:00 ` Vladimir Olensky
1999-06-03 0:00 ` Dale Stanbrough
1999-06-02 0:00 ` mike
1999-06-03 0:00 ` Robert Dewar
1999-06-06 0:00 ` David Botton
1999-06-07 0:00 ` Robert Dewar
1999-06-01 0:00 ` Richard D Riehle
1999-06-03 0:00 ` Matthew Heaney
1999-06-03 0:00 ` Matthew Heaney
1999-05-25 0:00 ` Samuel Mize
1999-05-25 0:00 ` Hyman Rosen
1999-05-25 0:00 ` David Starner
1999-05-26 0:00 ` Laurent Guerby
1999-05-26 0:00 ` Hyman Rosen
1999-05-28 0:00 ` Laurent Guerby
1999-06-01 0:00 ` Hyman Rosen
1999-06-03 0:00 ` Fraser Wilson
1999-05-26 0:00 ` Ole-Hjalmar Kristensen
1999-06-03 0:00 ` Matthew Heaney
1999-06-03 0:00 ` Hyman Rosen
1999-05-21 0:00 ` Dale Stanbrough
1999-05-20 0:00 ` bob
1999-05-21 0:00 ` Dale Stanbrough
1999-05-21 0:00 ` Richard D Riehle
1999-05-21 0:00 ` Shawn M. Root
1999-05-21 0:00 ` Richard D Riehle
1999-05-25 0:00 ` Shawn M. Root
1999-05-21 0:00 ` Marin David Condic
1999-05-21 0:00 ` Dan Nagle
1999-05-24 0:00 ` Marin David Condic
1999-05-21 0:00 ` Steve
1999-05-25 0:00 ` Don Overheu
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox