From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3498dd887729ed19 X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Garbage Collection in Ada Date: 1996/11/01 Message-ID: #1/1 X-Deja-AN: 193548908 sender: news@organon.com (news) references: <01bbc6a3$4cf03480$829d6482@joy.ericsson.se> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-11-01T00:00:00+00:00 List-Id: In article <3278C69B.310F@ehs.ericsson.se> Jonas Nygren writes: > Mitch Gart wrote: > > Jonas Nygren (ehsjony@ehs.ericsson.se) wrote: > > (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. > > Mitch, > > you are quite correct. The Object part should be in the private > part of the package and only Handle and its derivatives should > be in the visible part. This have the effect that type extension > can only be done in child packages. Pehaps I should have shown that > too in my example but I thought it might have caused information > overload. This shows up (at least in part) why for this sort of stuff (constructing GC behavior within the language - on a per app/per type basis) should use limited types (no assignment goof up) with unknown discriminants (user/client _can't_ call "new Object", but _must_ use the constructor). /Jon -- Jon Anthony Organon Motives, Inc. Belmont, MA 02178 617.484.3383 jsa@organon.com