From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Syntax for tagged record types (was Re: Not intended for use in medical,)
Date: 1997/05/28
Date: 1997-05-28T00:00:00+00:00 [thread overview]
Message-ID: <EACHUS.97May27222206@spectre.mitre.org> (raw)
In-Reply-To: mheaney-ya023680002405971626500001@news.ni.net
In article <mheaney-ya023680002405971626500001@news.ni.net> mheaney@ni.net (Matthew Heaney) writes:
> Maybe not: we just need some way of allocating the object on the
> stack, and letting the constructor manipulate that object, so that
> no copying is ever required. It would be really swell too, if in
> the constructor we were able to invoke the constructors for the
> object's components.
> An important goal, though, is for constructors for limited types
> that are indefinate.
Hmmm. Let's imagine a generic package:
generic
type Object_Type(<>) is limited private;
type Object_Ref is access Object_Type;
...
package Constructor is
Object: Object_Ref;
end Constructor;
pragma Elaborate_Body(Constructor);
package body Constructor is
...
end Constructor;
Now every time I instantiate this package, I create an Object_Ref,
and in the body I initialize it to point to a value in the body. For
some types the body can be completely in Ada, for others you might
have to use extensions/magic tricks/Unchecked_Conversions, etc. in the
body, and in particular, the decision whether or not to call
Unchecked_Access will almost certainly a significant design issue.
When I have played this game, I've done it three different ways:
1) N objects in the package which declares the type, and the
generic packages do reference counting. (Actually, it is easier to
make the _ref type a controlled type to begin with, but I digress.)
2) Unchecked_Access and programming standards about copying the
pointer object. (Or you could try making that type limited, but leave
out the unknown discriminants.)
3) Garbage collection provided courtesy of Unbounded_String. Be
careful to understand the game here. The safest is to have a
(private) token type which is access Unbounded_String, and a
conversion which produces an Object_Ref from it. To do otherwise, you
have to look at the implementation of Unbounded_String.
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next prev parent reply other threads:[~1997-05-28 0:00 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-04-23 0:00 Not intended for use in medical, Robert C. Leif, Ph.D.
1997-04-24 0:00 ` J. Florio
1997-04-25 0:00 ` Ken Garlington
1997-04-25 0:00 ` Kevin Cline
1997-04-25 0:00 ` Robert Dewar
1997-04-28 0:00 ` John Apa
1997-04-28 0:00 ` Robert Dewar
1997-04-29 0:00 ` Kaz Kylheku
1997-04-30 0:00 ` John Apa
[not found] ` <3367CE1E.5ED1@die_spammer.dasd.honeywell.com>
1997-05-01 0:00 ` Kaz Kylheku
1997-05-03 0:00 ` Simon Wright
1997-05-04 0:00 ` Kaz Kylheku
1997-05-04 0:00 ` Robert Dewar
1997-05-04 0:00 ` Richard Kenner
1997-05-05 0:00 ` Kaz Kylheku
1997-05-06 0:00 ` Kaz Kylheku
1997-05-06 0:00 ` Robert A Duff
1997-05-07 0:00 ` Kaz Kylheku
1997-05-08 0:00 ` Robert A Duff
1997-05-07 0:00 ` Robert Dewar
1997-05-08 0:00 ` John G. Volan
1997-05-10 0:00 ` Robert Dewar
1997-05-10 0:00 ` John G. Volan
1997-05-11 0:00 ` Robert Dewar
1997-05-11 0:00 ` John G. Volan
1997-05-11 0:00 ` Robert A Duff
1997-05-12 0:00 ` John G. Volan
1997-05-12 0:00 ` Robert Dewar
1997-05-11 0:00 ` John G. Volan
1997-05-11 0:00 ` Robert Dewar
1997-05-12 0:00 ` John G. Volan
1997-05-12 0:00 ` Robert Dewar
1997-05-17 0:00 ` Robert I. Eachus
[not found] ` <dewar.863877808@merv>
1997-05-17 0:00 ` Robert Dewar
1997-05-17 0:00 ` Jon S Anthony
1997-05-21 0:00 ` Syntax for tagged record types (was Re: Not intended for use in medical,) Ben Brosgol
1997-05-20 0:00 ` Matthew Heaney
1997-05-21 0:00 ` Jon S Anthony
1997-05-21 0:00 ` Matthew Heaney
1997-05-22 0:00 ` Robert I. Eachus
1997-05-25 0:00 ` Matthew Heaney
1997-05-28 0:00 ` Robert I. Eachus
1997-05-23 0:00 ` Jon S Anthony
1997-05-23 0:00 ` Simon Wright
1997-05-23 0:00 ` Matthew Heaney
1997-05-25 0:00 ` Jon S Anthony
1997-05-28 0:00 ` Syntax for tagged record types (was Re David Kristola
1997-05-21 0:00 ` Syntax for tagged record types and class types Mats Weber
1997-05-21 0:00 ` Matthew Heaney
1997-05-22 0:00 ` Mats Weber
1997-05-27 0:00 ` Tucker Taft
1997-05-30 0:00 ` Mats.Weber
1997-05-22 0:00 ` Samuel A. Mize
1997-05-22 0:00 ` Samuel A. Mize
1997-05-23 0:00 ` Mats Weber
[not found] ` <mheaney-ya023680002005972314260001@news.ni.net <mheaney-ya023680002105972302430001@news.ni.net>
1997-05-22 0:00 ` Syntax for tagged record types (was Re: Not intended for use in medical,) Robert A Duff
1997-05-22 0:00 ` John G. Volan
1997-05-23 0:00 ` Matthew Heaney
1997-05-23 0:00 ` Jon S Anthony
1997-05-23 0:00 ` John G. Volan
1997-05-24 0:00 ` Robert A Duff
1997-05-24 0:00 ` Matthew Heaney
1997-05-28 0:00 ` Robert I. Eachus [this message]
1997-05-25 0:00 ` Jon S Anthony
1997-05-23 0:00 ` Matthew Heaney
1997-05-25 0:00 ` Jon S Anthony
1997-05-25 0:00 ` Robert Dewar
1997-05-27 0:00 ` Ray Blaak
1997-05-23 0:00 ` Jon S Anthony
1997-05-12 0:00 ` Not intended for use in medical, John G. Volan
1997-05-12 0:00 ` Language Design Mistakes (was "not intended...") W. Wesley Groleau (Wes)
1997-05-13 0:00 ` Robert Dewar
1997-05-13 0:00 ` Robert A Duff
1997-05-14 0:00 ` Robert Dewar
1997-05-13 0:00 ` W. Wesley Groleau (Wes)
1997-05-08 0:00 ` Not intended for use in medical, Kaz Kylheku
1997-05-08 0:00 ` Robert Dewar
1997-05-09 0:00 ` Kaz Kylheku
1997-05-12 0:00 ` W. Wesley Groleau (Wes)
1997-05-12 0:00 ` John G. Volan
1997-05-14 0:00 ` Nick Roberts
1997-05-14 0:00 ` Robert Dewar
1997-05-14 0:00 ` Jeff Carter
[not found] ` <dewar.863632434@merv>
1997-05-15 0:00 ` Kaz Kylheku
1997-05-18 0:00 ` Robert Dewar
1997-05-15 0:00 ` Kaz Kylheku
1997-05-08 0:00 ` Robert A Duff
1997-05-09 0:00 ` Robert I. Eachus
1997-05-11 0:00 ` Robert Dewar
1997-05-11 0:00 ` Matthew Heaney
1997-05-12 0:00 ` Robert Dewar
1997-05-12 0:00 ` Matthew Heaney
1997-05-13 0:00 ` Jon S Anthony
1997-05-13 0:00 ` Matthew Heaney
1997-05-14 0:00 ` Robert Dewar
1997-05-14 0:00 ` Robert Dewar
1997-05-14 0:00 ` Robert Dewar
1997-05-14 0:00 ` Nick Roberts
1997-05-14 0:00 ` Robert Dewar
1997-05-15 0:00 ` W. Wesley Groleau (Wes)
1997-05-12 0:00 ` Robert I. Eachus
1997-05-13 0:00 ` Robert Dewar
1997-05-14 0:00 ` Nick Roberts
1997-05-14 0:00 ` Robert Dewar
[not found] ` <01bc6182$30e3a7c0$LocalHost@xhv46.dial.pipex.com>
1997-05-16 0:00 ` Robert A Duff
1997-05-16 0:00 ` Robert I. Eachus
1997-05-18 0:00 ` Nick Roberts
1997-05-18 0:00 ` Matthew Heaney
1997-05-19 0:00 ` Robert I. Eachus
1997-05-19 0:00 ` Matthew Heaney
1997-05-20 0:00 ` Nick Roberts
1997-05-20 0:00 ` Matthew Heaney
1997-05-21 0:00 ` Dale Stanbrough
1997-05-19 0:00 ` Robert A Duff
1997-05-16 0:00 ` Robert Dewar
1997-05-04 0:00 ` Richard Kenner
1997-05-04 0:00 ` Robert Dewar
1997-04-28 0:00 ` John M. Mills
1997-04-30 0:00 ` Larry Kilgallen
1997-05-02 0:00 ` Nick Roberts
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox