comp.lang.ada
 help / color / mirror / Atom feed
From: "Vladimir Olensky" <vladimir_olensky@yahoo.com>
Subject: Re: Generic Instances Scope control  ???
Date: 2000/02/23
Date: 2000-02-23T00:00:00+00:00	[thread overview]
Message-ID: <sb80kqdvr2a99@corp.supernews.com> (raw)
In-Reply-To: m31z64y1hh.fsf@ns52.infomatch.bc.ca

   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" <vladimir_olensky@yahoo.com> 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;













  reply	other threads:[~2000-02-23  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-22  0:00 Generic Instances Scope control ??? Vladimir Olensky
2000-02-22  0:00 ` Ray Blaak
2000-02-23  0:00   ` Vladimir Olensky [this message]
2000-02-23  0:00     ` Ray Blaak
replies disabled

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