comp.lang.ada
 help / color / mirror / Atom feed
* AI-344, generics/instances...
@ 2004-09-16 12:58 Martin Dowie
  2004-09-16 17:51 ` Randy Brukardt
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Dowie @ 2004-09-16 12:58 UTC (permalink / raw)


Just a thought that popped into my head and I wanted a 'sanity' check on if
first...

With AI-344 generic packages that define a tagged type no longer have to be
instantiated at library level. I was wondering if it would be useful to
define a mechanism (pragma?) that allowed an author to insist that a generic
package be instantiated at library level.

This came to me when I was looking at my Singleton pattern, which is just
fine for Ada95 but will be much more open to abuse come Ada0Y. My code looks
roughly like this:

  generic
  package Patterns.Generic_Singletons is
     type Singleton is tagged private;
  private
     -- Implementation that uses assumes library level instance
  end Patterns.Generic_Singletons;

Perhaps something as simple as:

  generic
  package Patterns.Generic_Singletons is
     pragma Library_Level_Unit; -- new pragma
     type Singleton is tagged private;
  private
     -- Implementation that uses assumes library level instance
  end Patterns.Generic_Singletons;

Our am I missing something?

Cheers
-- Martin






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

end of thread, other threads:[~2004-09-17 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-16 12:58 AI-344, generics/instances Martin Dowie
2004-09-16 17:51 ` Randy Brukardt
2004-09-16 20:03   ` Martin Dowie
2004-09-17  8:51   ` Peter Hermann
2004-09-17 11:19     ` Number_Base 36 revisited (was: AI-344, generics/instances...) Marius Amado Alves
2004-09-17 13:26     ` AI-344, generics/instances Martin Dowie

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