comp.lang.ada
 help / color / mirror / Atom feed
* Instantiation of child generics?
@ 1996-07-26  0:00 Dale Stanbrough
  1996-07-26  0:00 ` Robert A Duff
  1996-07-26  0:00 ` Tucker Taft
  0 siblings, 2 replies; 7+ messages in thread
From: Dale Stanbrough @ 1996-07-26  0:00 UTC (permalink / raw)



Hi,

I'ld like to create an abstract generic queue package with bounded
and unbounded children. However I have been thwarted in all attempts
to instantiate them. Also I don't really understand the rules for
instantiaion of child generics. Can anyone explain them?


e.g. 

	generic
		type element is private;
	package queues is 
		type queue is abstract tagged null record;
		
		procedure init return queue is abstract;
		
		procedure enqueue(item:in out queue; item:element) is abstract;

		-- etc
	end queues;
	
	
	generic
		size	:natural;
	package queues.bounded is
			
		type queue is new queues.queue with private;
		
		procedure init return queue is abstract;
		
		procedure enqueue(item:in out queue; item:element) is abstract;

	private
		type queue is new queues.queue with null record; -- for now...
	end;


How do I instantiate this?

	with queues.bounded;
	package myQ is new queues.bounded(integer, 5);
	
results in Gnat telling me "invalid prefix in selected component "queues""

Also will my (re)use of the identifier "queue" in the packages cause any
problems for me? It seems to compile ok, but i'm concerned that there might
be some nasty visibility issue lurking around the corner...

Thanks,

Dale




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1996-07-30  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-26  0:00 Instantiation of child generics? Dale Stanbrough
1996-07-26  0:00 ` Robert A Duff
1996-07-26  0:00 ` Tucker Taft
1996-07-26  0:00   ` Kevin J. Weise
1996-07-27  0:00     ` Robert A Duff
1996-07-30  0:00       ` Dale Stanbrough
1996-07-30  0:00         ` Robert A Duff

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