comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Dowie" <martin.dowie@baesystems.com>
Subject: AI-344, generics/instances...
Date: Thu, 16 Sep 2004 13:58:35 +0100
Date: 2004-09-16T13:58:35+01:00	[thread overview]
Message-ID: <41498c90$1_1@baen1673807.greenlnk.net> (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






             reply	other threads:[~2004-09-16 12:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-16 12:58 Martin Dowie [this message]
2004-09-16 17:51 ` AI-344, generics/instances 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
replies disabled

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