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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8eff44ec1bcf8433 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-18 09:10:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <9qctpn$lil$1@news.huji.ac.il> <3BCA86C7.BB252751@acm.org> <%jYy7.31350$ev2.37672@www.newsranger.com> <3BCD7C50.647ADBD0@brighton.ac.uk> <3BCEF4B8.B1AC6965@brighton.ac.uk> Subject: Re: Container reqs Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Thu, 18 Oct 2001 12:02:18 EDT Organization: http://www.newsranger.com Date: Thu, 18 Oct 2001 16:02:18 GMT Xref: archiver1.google.com comp.lang.ada:14895 Date: 2001-10-18T16:02:18+00:00 List-Id: In article <3BCEF4B8.B1AC6965@brighton.ac.uk>, John English says... > >I do something like this in JEWL. There's a reference-counted tagged >type in package JEWL (non-generic parent): > > type Reference_Counted_Type is tagged limited > record > Count : Natural := 1; > end record; > > procedure Cleanup (Object : in out Reference_Counted_Type); > > type Reference_Counted_Ptr is access all Reference_Counted_Type'Class; > > type Controlled_Type is new Ada.Finalization.Controlled with > record > Pointer : Reference_Counted_Ptr; > end record; > > procedure Finalize (Object : in out Controlled_Type); > procedure Adjust (Object : in out Controlled_Type); > >and then JEWL.Windows (which is generic) uses this Controlled_Type as >a component (actually *the* component) in all the window types, so that >all windows are implemented as pointers to reference-counted types. >The actual object that a particular type of window points to is one >of a variety of possible derivations which are defined in a private >child and produced by constructor (factory) functions. I still don't see how that allows you to declare something in the generic that can be managed by the controlled object. You can manage the "reference_counted_type", but if I declare some new type that needs to be managed in my generic, the only way to get Controlled_Type to manage it is to derive it from "reference_counted_type". If I do that, I'm back to the situation where my generic can only be instantiated at the library level. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.