comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Garbage Collection in Ada
Date: 1996/11/03
Date: 1996-11-03T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023280000311962335300001@news.ni.net> (raw)
In-Reply-To: E055IC.26I.0.-s@inmet.camb.inmet.com


In article <E055IC.26I.0.-s@inmet.camb.inmet.com>, mg@harp.camb.inmet.com
(Mitch Gart) wrote:

>: package Collected is
>
>(snip)
>
>This suffers from several problems:
>
>- If you provide a function to do allocations,
>
>    function Allocate_Obj return Handle;
>
>  and users use this function, things work well, but if a user calls
>  "new Object" directly things don't work at all.  
>
>- Obj1 := Obj2;      doesn't work because the reference count value is
>  copied.  If Obj2's count is 3 before the assignment, after the assignment
>  Obj1's count is also 3 which is probably wrong.

Actually, Mitch's example points out what I feel is an omission in the
langauge: the ability to overload the access object deference operator
"all".

(Yeah, yeah, I already _know_ it's not an operator.  My point is that I
want it to be.)

I like having the control of finalization of objects, but I would also like
the ability to finalize an access object, so that when its lifetime ends I
can decrement a reference count.

The previous examples in this thread do that, but there's a large syntactic
difference between manipulating an Ada access object and those that aren't
access objects.  I don't want to have to do any work to get at the "real"
access object component of a (controlled) handle object.

I want to be able to define a type that's a subtype of
Finalization.Controlled, and define primitive operations for it so that
it's syntactically identical to an access type.  I don't want the user of
my "access type" to have to do anything different than he would have do to
when manipulating a "normal" access type.

So I want to be able to do this

   type T is ...;
   type TA is private;

   function "new" (O : T) return TA;
   function "all" (O : TA) return T;
private
   type T_Rep is
      record
         O : T;
         Count : Natural;
      end record;

   type TA_Rep is access T_Rep;

   type TA is new Finalization.Controlled with
      record
         Rep : TA_Rep;
      end record;
...
   O : TA := ...;
begin
      ... O.all ...   


If this package were generic (with T as its generic formal type), then I
suppose this access type would be very reusable.

Whatever else you might think about C++, you have to admit that letting the
programmer define operators for his class-types, to make them look like
built-in types, is very nice.

Language designers: any reason why overloading "all" would be too hard?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
mheaney@ni.net
(818) 985-1271




  parent reply	other threads:[~1996-11-03  0:00 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <01bbc6a3$4cf03480$829d6482@joy.ericsson.se>
1996-10-31  0:00 ` Garbage Collection in Ada Mitch Gart
1996-10-31  0:00   ` Jonas Nygren
1996-11-03  0:00   ` Matthew Heaney [this message]
1996-11-06  0:00     ` Robert A Duff
1996-11-06  0:00       ` Norman H. Cohen
1996-11-01  0:00 ` Jon S Anthony
1996-11-06  0:00 ` Brian Rogoff
1996-11-07  0:00   ` Tucker Taft
1996-11-02  0:00 Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-10-22  0:00 Brian Rogoff
1996-10-13  0:00 Jonas Nygren
1996-10-13  0:00 ` Robert Dewar
1996-10-13  0:00 ` Lars Farm
1996-10-13  0:00   ` Robert Dewar
     [not found]     ` <19961014115513529729@dialup105-2-16.swipnet.se>
1996-10-16  0:00       ` Robert Dewar
1996-10-16  0:00         ` Lars Farm
1996-10-16  0:00           ` Robert Dewar
1996-10-16  0:00             ` Hans-Juergen Boehm
1996-10-17  0:00               ` Robert Dewar
1996-10-17  0:00                 ` Hans-Juergen Boehm
1996-10-17  0:00               ` Robert A Duff
1996-10-17  0:00                 ` Larry Kilgallen
1996-10-17  0:00                 ` Hans-Juergen Boehm
1996-10-17  0:00             ` Lars Farm
1996-10-23  0:00               ` Robert Dewar
1996-10-16  0:00         ` Hans-Juergen Boehm
1996-10-16  0:00           ` Robert Dewar
1996-10-16  0:00             ` Hans-Juergen Boehm
1996-10-17  0:00               ` Robert Dewar
1996-10-17  0:00                 ` Hans-Juergen Boehm
1996-10-17  0:00                   ` Robert Dewar
1996-10-13  0:00   ` Larry Kilgallen
1996-10-14  0:00   ` John Howard
1996-10-15  0:00     ` Lars Farm
1996-10-15  0:00       ` Robert Dewar
1996-10-15  0:00         ` Hans-Juergen Boehm
1996-10-15  0:00         ` Lars Farm
1996-10-17  0:00         ` Thomas Kendelbacher
1996-10-17  0:00           ` Robert Dewar
1996-10-23  0:00         ` Richard A. O'Keefe
1996-10-23  0:00           ` Larry Kilgallen
1996-10-15  0:00       ` Robert A Duff
1996-10-14  0:00   ` Robert A Duff
1996-10-14  0:00     ` Lars Farm
1996-10-15  0:00       ` Robert A Duff
1996-10-16  0:00         ` Lars Farm
1996-10-16  0:00           ` Robert Dewar
1996-10-17  0:00             ` Robert A Duff
1996-10-19  0:00               ` Robert Dewar
1996-10-19  0:00                 ` Lars Farm
1996-10-20  0:00                   ` Robert Dewar
1996-10-20  0:00                     ` Robert A Duff
1996-10-20  0:00                       ` Robert Dewar
1996-10-21  0:00                     ` Geert Bosch
1996-10-21  0:00                       ` Hans-Juergen Boehm
1996-10-21  0:00                     ` Lars Farm
1996-10-21  0:00                       ` Robert Dewar
1996-10-21  0:00                         ` Lars Farm
1996-10-23  0:00                     ` Fergus Henderson
1996-10-24  0:00                     ` Richard A. O'Keefe
1996-10-20  0:00                 ` Robert A Duff
1996-10-20  0:00                   ` Robert Dewar
1996-10-21  0:00                     ` Hans-Juergen Boehm
1996-10-21  0:00                       ` Robert Dewar
1996-10-19  0:00               ` Richard Kenner
1996-10-15  0:00     ` Hans-Juergen Boehm
1996-10-15  0:00   ` Keith Thompson
1996-10-14  0:00 ` Jon S Anthony
1996-10-15  0:00   ` Robert Dewar
1996-10-15  0:00 ` Hannes Haug
1996-10-15  0:00 ` Robert I. Eachus
1996-10-15  0:00   ` Robert Dewar
1996-10-16  0:00   ` whiting_ms@corning.com (Matt Whiting)
1996-10-16  0:00     ` Robert Dewar
1996-10-17  0:00   ` John Howard
1996-10-17  0:00     ` Robert Dewar
1996-10-18  0:00       ` Hans-Juergen Boehm
1996-10-18  0:00       ` Lars Farm
1996-10-19  0:00         ` Robert Dewar
1996-10-20  0:00           ` Lars Farm
1996-10-21  0:00             ` Robert Dewar
1996-10-22  0:00               ` Lars Farm
1996-10-21  0:00             ` Nicolay Belofastow
1996-10-21  0:00               ` Robert Dewar
1996-10-20  0:00         ` Robert A Duff
1996-10-20  0:00           ` Robert Dewar
1996-10-22  0:00         ` Mitch Gart
1996-10-23  0:00           ` Fergus Henderson
1996-10-23  0:00           ` Hans-Juergen Boehm
1996-10-27  0:00             ` Richard Riehle
1996-10-29  0:00         ` Jon S Anthony
1996-10-30  0:00         ` Jonas Nygren
1996-10-30  0:00         ` Brian Rogoff
1996-10-30  0:00         ` Jon S Anthony
1996-10-30  0:00         ` James Rogers
1996-10-18  0:00       ` Lars Farm
1996-10-20  0:00         ` Robert A Duff
1996-10-16  0:00 ` Jon S Anthony
1996-10-16  0:00 ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1996-10-16  0:00   ` Robert Dewar
1996-10-16  0:00 ` Jon S Anthony
1996-10-16  0:00 ` Jon S Anthony
1996-10-17  0:00   ` Robert Dewar
1996-10-16  0:00 ` Jon S Anthony
1996-10-17  0:00 ` Rick Hudson
1996-10-17  0:00 ` Robert I. Eachus
1996-10-17  0:00   ` Robert Dewar
1996-10-17  0:00     ` Richard Kenner
1996-10-17  0:00 ` Hans-Juergen Boehm
1996-10-18  0:00 ` Jon S Anthony
1996-10-18  0:00   ` Robert Dewar
1996-10-18  0:00 ` Jon S Anthony
1996-10-23  0:00   ` Robert Dewar
1996-10-18  0:00 ` Rick Hudson
1996-10-21  0:00 ` Jon S Anthony
1996-10-21  0:00 ` Laurent Pautet
1996-10-22  0:00 ` Tapani Rundgren
1996-10-22  0:00 ` Jon S Anthony
1996-10-23  0:00 ` Jon S Anthony
1996-10-24  0:00   ` Mitch Gart
1996-10-24  0:00 ` Robert I. Eachus
1996-10-24  0:00 ` Hans-Juergen Boehm
1996-10-25  0:00 ` Jon S Anthony
1996-10-28  0:00 ` Robert I. Eachus
1996-10-29  0:00 ` Hans-Juergen Boehm
1996-10-11  0:00 C++ Standardization (was: Once again, Ada absent from DoD SBIR solicitation) Dave Wood
1996-10-17  0:00 ` Garbage Collection in Ada Thomas Kendelbacher
replies disabled

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