comp.lang.ada
 help / color / mirror / Atom feed
* private types - controlled
@ 1996-02-24  0:00 Jonas Nygren
  0 siblings, 0 replies; only message in thread
From: Jonas Nygren @ 1996-02-24  0:00 UTC (permalink / raw)



I am trying to write support for shared objects
using reference counts and Ada.Finalization. The
shared object should be possible to extend while the
references should not.

Further I would like to have two version of references
which could be used to provide "different interfaces" to
the same object in an implementation, constant and
non-constant. I also want to be able to convert from
non-constant to constant but not the other way around.

So my code looks something like this:

with Ada.Finalization;
package Shared_Objects is
   type Shared_Object is tagged private;
   type Constant_Reference is private;
   type Reference is private;
   function To_Constant (R : Reference) return Constant_Reference;
private
   type Shared_Object is ....; 
   type Constant_Reference is new Ada.Finalization.Controlled with ...;
   type Reference is new Constant_Reference with null record;
end Shared_Objects;

The problem I get here is To_Constant. Gnat says:

  sharobje.ads:36:09: type must be declared abstract or "To_Constant" overridden

(line 36 being the line 'type Reference is new Constant_Reference with null record;')

I really don't understand what I should do to get this to work - what should I do 
to get this to work?

(I know about not having two controlling operands in a function interface but
at the point of declaration the types Reference and Constant_Reference are
private and hence, To_Constant is not a 'primitive operation' of any
tagged object)

/jonas





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-02-24  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-02-24  0:00 private types - controlled Jonas Nygren

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