comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada 95 constructors on limited types
Date: Sat, 05 Jan 2008 09:59:07 -0500
Date: 2008-01-05T09:59:07-05:00	[thread overview]
Message-ID: <wccy7b4xqro.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 874pds36mu.fsf@ludovic-brenta.org

Ludovic Brenta <ludovic@ludovic-brenta.org> writes:

> Brian May writes:
>>>>>>> "Jeffrey" == Jeffrey R Carter <spam.jrcarter.not@acm.nospam.org> writes:
>>
>>     Jeffrey> shaunpatterson@gmail.com wrote:
>>     >> 
>>     >> package Parent is
>>     >> 
>>     >> type Class is abstract tagged limited null record;
>>     >> type Class_Access is access all Class'Class;
>>     >> 
>>     >> end Parent;
>>
>>     Jeffrey> There's your problem. Don't use public access types.
>>
>> Why not?
>
> Because they automatically make the package impure for no good reason,
> thereby preventing use of the package in pure or preelabotated
> packages.  Moral: Declare your access types only if and where you need
> them.

Jeff was complaining only about PUBLIC access types.
I don't entirely agree with him -- at least, I'd put
it less strongly.

But anyway, the purity issue applies to access types
whether they are public or not.  I agree that it's
good to make things Pure when possible.

Note that the rule was relaxed in Ada 2005 -- you can say:

    type T is access Blah;
    for T'Storage_Size use 0;

and still have pragma Pure.  You can also have access-to-constant
and access-to-subprogram types.

- Bob



  reply	other threads:[~2008-01-05 14:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-02 14:31 Ada 95 constructors on limited types shaunpatterson
2008-01-02 14:49 ` Dmitry A. Kazakov
2008-01-02 16:02 ` Robert A Duff
2008-01-02 16:20 ` Jeffrey R. Carter
2008-01-02 22:57   ` Brian May
2008-01-02 23:53     ` Jeffrey R. Carter
2008-01-05 10:32     ` Ludovic Brenta
2008-01-05 14:59       ` Robert A Duff [this message]
2008-01-08  1:58         ` Randy Brukardt
2008-01-02 18:36 ` Martin Krischik
2008-01-04  1:38   ` Randy Brukardt
replies disabled

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