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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,83a22b00dc8daff3 X-Google-Attributes: gid103376,public From: "Vladimir Olensky" Subject: Re: Generic Instances Scope control ??? Date: 2000/02/23 Message-ID: #1/1 X-Deja-AN: 588877606 References: Organization: Posted via Supernews, http://www.supernews.com X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: comp.lang.ada X-Complaints-To: newsabuse@supernews.com Date: 2000-02-23T00:00:00+00:00 List-Id: Though what you suggest simplifies the initial problem ( reducing the number of visible details to only one) but it does not solve the essence of the problem. Client still need to make one generic package instance per each declared controller object. The point is to hide all that completely from the client. Client should not know anything except that he should declare controller object to be able to work with it. Everything should be done automatically by object constructor which in our case is Ada.Finalization.Initialize procedure and have a life span until Finalize procedure is called. Regards, Vladimir Olensky ================================= Ray Blaak wrote in message ... >"Vladimir Olensky" writes: >> procedure tst_Gen is >> >> c1 : Controller_Type; >> procedure c1_stat is new GStat (Controller => c1); >> --> want to hide c1_stat from client >[...] >> begin >> >> Register_Callback (c1, c1_stat'Unrestricted_Access); >> --> want to hide Register_Callback from client >[...] > >Just do the instantiation and registeration in another package; no scope >operator is needed: > > with G; use G; > generic > Controller : in out Controller_Type; > package Register_GStat is > end Register_GStat > > package body Register_GStat is > procedure Stat is new GStat (Controller => Controller); > begin > Register_Callback (Controller, Stat'Unrestricted_Access); > end Register_GStat; > >and then: > > procedure tst_Gen is > c1 : Controller_Type; > package c1_stat is new Register_GStat (Controller => c1); ----> Want c1_stat to be hidden - initial problem still exists > begin > -- Register_Callback is already called by this point. > ... > end test_Gen;