From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Specialization
Date: 01 Jun 2002 11:30:03 -0400
Date: 2002-06-01T15:37:28+00:00 [thread overview]
Message-ID: <ur8jr2f0k.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: x7vofewhzgz.fsf@pushface.org
Simon Wright <simon@pushface.org> writes:
> Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov> writes:
>
> > One more: require the client to pass in a Finalize procedure:
> >
> > generic
> > type Element is private;
> > with procedure Finalize (Item : in out Element) is <>;
> > package Foo is
> > type Element_array is array (1 .. 10) of Element;
> >
> > procedure Empty (Item : in out Element_Array);
> >
> > end Foo;
> >
> > Now Empty can call Finalize on each element of the array. For
> > non-controlled types, Finalize can be a null operation. This is the
> > approach I use in SAL; it allows a generic package to be
> > instantiated with the widest range of types.
>
> I like this.
>
> The Element probably has to be visibly (to the client) controlled, for
> her to get hold of the Finalize.
Either that, or some "Free" operation is visible.
In SAL, I actually call this parameter "Free_Item", not "Finalize". I
was focussed more on the constrained/unconstrained and
definite/indefinite issues, which determine whether the container
elements are allocated or not, rather than on Controlled types. But
the same mechanism works for both, which is why I use it.
--
-- Stephe
next prev parent reply other threads:[~2002-06-01 15:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-30 12:39 Specialization Baugereau
2002-05-30 17:09 ` Specialization Ted Dennison
2002-05-30 17:29 ` Specialization Baugereau
2002-05-30 19:20 ` Specialization Stephen Leake
2002-05-30 19:48 ` Specialization Baugereau
2002-05-31 1:18 ` Specialization Jim Rogers
2002-05-31 5:41 ` Specialization Sergey Koshcheyev
2002-05-31 11:36 ` Specialization Baugereau
2002-05-31 14:08 ` Specialization Jim Rogers
2002-05-31 16:45 ` Specialization Hyman Rosen
2002-05-31 17:05 ` Specialization Sergey Koshcheyev
2002-05-31 17:40 ` Specialization Hyman Rosen
2002-05-31 20:04 ` Specialization Sergey Koshcheyev
2002-05-31 21:25 ` Specialization Hyman Rosen
2002-05-31 13:27 ` Specialization Stephen Leake
2002-05-31 19:46 ` Specialization Simon Wright
2002-06-01 15:30 ` Stephen Leake [this message]
2002-05-31 19:44 ` Specialization Simon Wright
2002-06-01 15:25 ` Specialization Stephen Leake
2002-06-01 17:12 ` Specialization Simon Wright
2002-06-01 19:50 ` Specialization Stephen Leake
2002-05-30 17:46 ` Specialization Toshitaka Kumano
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox