comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: class-wide objects
Date: 1998/12/11
Date: 1998-12-11T00:00:00+00:00	[thread overview]
Message-ID: <u1zm6bc9j.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: m31zm84g2m.fsf@mheaney.ni.net

Matthew Heaney <matthew_heaney@acm.org> writes:

> Then just make it non-primitive:
> 
> generic
>    ...
> package Stacks is
> 
>    type Stack_Type is ...
> ...
>    package Constructors is
> 
>       function  Copy (Stack : Stack_Type) return Stack_Access;
> 
>    end;
> ...
> end Stacks;
> 
> 
> Because Copy is non-primitive, it won't get inherited during derivation.
> 

Another way to make an operation non-primitive is to use 'class:

function Copy (Stack : Stack_Type'class) return Stack_Access;

I've been flip-flopping about which way is "best". Using 'class
sometimes implies re-dispatching in the body, but not always. If the
non-primitive operations belong in a group (like Constructors), then
the local package seems neat. But for other operations, a local
package is just noise, and 'class seems preferable.

-- Stephe




  parent reply	other threads:[~1998-12-11  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-07  0:00 class-wide objects Francois Godme
1998-12-07  0:00 ` Tom Moran
1998-12-07  0:00 ` Matthew Heaney
1998-12-06  0:00   ` David Botton
1998-12-09  0:00   ` Francois Godme
1998-12-10  0:00     ` Matthew Heaney
1998-12-10  0:00       ` Francois Godme
1998-12-11  0:00       ` Stephen Leake [this message]
1998-12-12  0:00         ` Francois Godme
1998-12-07  0:00 ` Tucker Taft
1998-12-07  0:00   ` Francois Godme
replies disabled

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