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

* Re: AI-344, generics/instances...
  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
  0 siblings, 2 replies; 6+ messages in thread
From: Randy Brukardt @ 2004-09-16 17:51 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@baesystems.com> wrote in message
news:41498c90$1_1@baen1673807.greenlnk.net...
> 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.

We tried that (to solve a different problem), and it led to no end of
troubles. (Mostly contract problems in generic bodies.) We gave up on it in
favor of defining Restrictions of the packages in question. See older
versions of AI-303 for details. But we weren't really trying to do that for
user code.

Probably the best way to do that for user code would be to define a
Restriction similar to No_Dependence. But that probably would be
controversial; we ended up limiting No_Dependence to only language-defined
units because of concerns with supporting user-defined units. (And in any
case it is too late for the standard; the scope of the Amendment is set, and
the hope is to approve all of the amendments at the next meeting -- which
starts tomorrow.)

                    Randy.






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

* Re: AI-344, generics/instances...
  2004-09-16 17:51 ` Randy Brukardt
@ 2004-09-16 20:03   ` Martin Dowie
  2004-09-17  8:51   ` Peter Hermann
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Dowie @ 2004-09-16 20:03 UTC (permalink / raw)


"Randy Brukardt" <randy@rrsoftware.com> wrote in message 
news:6ZCdnTuj2N7qT9TcRVn-
> Probably the best way to do that for user code would be to define a
> Restriction similar to No_Dependence. But that probably would be
> controversial; we ended up limiting No_Dependence to only language-defined
> units because of concerns with supporting user-defined units. (And in any
> case it is too late for the standard; the scope of the Amendment is set, 
> and
> the hope is to approve all of the amendments at the next meeting -- which
> starts tomorrow.)

I thought that - but I'll happily wait for Ada1Z! :-)





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

* Re: AI-344, generics/instances...
  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
  1 sibling, 2 replies; 6+ messages in thread
From: Peter Hermann @ 2004-09-17  8:51 UTC (permalink / raw)


Randy Brukardt <randy@rrsoftware.com> wrote:
> the hope is to approve all of the amendments at the next meeting -- which
> starts tomorrow.)

Oh my goodness!
Dont forget to insert this tiny change:   3
                                          |
subtype Number_Base is Integer range 2 .. 16;

AC-00070   :-)

(afraid to wait another 10 years for a useful Ada2015)

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



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

* Number_Base 36 revisited (was: AI-344, generics/instances...)
  2004-09-17  8:51   ` Peter Hermann
@ 2004-09-17 11:19     ` Marius Amado Alves
  2004-09-17 13:26     ` AI-344, generics/instances Martin Dowie
  1 sibling, 0 replies; 6+ messages in thread
From: Marius Amado Alves @ 2004-09-17 11:19 UTC (permalink / raw)
  To: comp.lang.ada

> Dont forget to insert this tiny change:   3
>                                           |
> subtype Number_Base is Integer range 2 .. 16;
> 
> AC-00070   :-)
> 
> (afraid to wait another 10 years for a useful Ada2015)

FWIW, I back up this proposal. I reviewed prior discussion, and to me 
clearly the pros beat the cons.





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

* Re: AI-344, generics/instances...
  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     ` Martin Dowie
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Dowie @ 2004-09-17 13:26 UTC (permalink / raw)


Peter Hermann wrote:
> Randy Brukardt <randy@rrsoftware.com> wrote:
>> the hope is to approve all of the amendments at the next meeting --
>> which starts tomorrow.)
>
> Oh my goodness!
> Dont forget to insert this tiny change:   3
>                                           |
> subtype Number_Base is Integer range 2 .. 16;
>
> AC-00070   :-)
>
> (afraid to wait another 10 years for a useful Ada2015)

Much as I'd love to see this in too (it would be incredibly useful in the
project along the hall from me...), it's an AC not an AI, so wait on... :-(






^ 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