comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Reason for 'Ada.Strings.Bounded' not being declared 'pragma Pure' ?
Date: Thu, 5 Dec 2013 14:17:05 -0600
Date: 2013-12-05T14:17:05-06:00	[thread overview]
Message-ID: <l7qn02$v8t$1@loke.gir.dk> (raw)
In-Reply-To: 52a04caa$0$6636$9b4e6d93@newsspool2.arcor-online.net

We re-analyzed all of the existing packages for Ada 2005, and changed the 
categorization of some of them. The details can be found in AI95-0362-1 
(http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00362.txt).

There is a listing of every predefined package in that AI. Here's the entry 
for Bounded strings:

Ada.Strings.Bounded -- A.4.4; Preelaborate
  This package contains no state, no dependence on non-pure units, no
  other items that prevent the package from being pure, and does not declare
  any types that would be a problem for Annex E, so it could be declared 
pure.
  But it's large and complex, and many of the operations are not 
conceptually
  pure (they do in-place updates), so no change is recommended.

This admittedly does not seem very satisfying. We didn't redo this exercise 
for Ada 2012, the only change we made was to make Stream_IO preelaborated so 
that loggers and the like can be written. (It's not practical to make the 
full Text_IO preelaborated [the obvious approach is not task-safe], and 
there was no agreement on the contents of a preelaborable subset.) I suppose 
you could send a request to reconsider this to Ada-Comment (but it would 
probably have to wait until the next Standard, whenever that is).

Someone asked about Ada.Tags. The entry for it says:

Ada.Tags -- 3.9; not categorized
  Package Tags has state, so it cannot be pure. That state is generally 
either
  set up at link-time (before elaboration) or during the elaboration of 
tagged
  types (that is, during the elaboration of other units). In either case, no
  complex state need be initialized at elaboration time. Thus, this package
  can be Preelaborated.

(The "state" that is talked about here is the table of internal tag <=> 
external tag mappings. Distributing that could be a significant overhead.) 
Making it Pure is not practical.

                                 Randy.

"Georg Bauhaus" <rm.dash-bauhaus@futureapps.de> wrote in message 
news:52a04caa$0$6636$9b4e6d93@newsspool2.arcor-online.net...
> On 05.12.13 04:58, Rod Kay wrote:
>> Hi all,
>>
>>     Would anyone know the reason for this ?
>
> Two possible reasons, guessing:
>
> 1) pragma Pure being >= Ada 95, and compatibility,
>
> 2) an implementation may choose to use pointers internally.
> 


  reply	other threads:[~2013-12-05 20:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  3:58 Reason for 'Ada.Strings.Bounded' not being declared 'pragma Pure' ? Rod Kay
2013-12-05  6:50 ` Shark8
2013-12-05  8:16   ` Rod Kay
2013-12-05  9:51 ` Georg Bauhaus
2013-12-05 20:17   ` Randy Brukardt [this message]
2013-12-06  3:03     ` Brad Moore
2013-12-06  4:43       ` Rod Kay
2013-12-06  4:36     ` Rod Kay
2013-12-06  4:28   ` Rod Kay
replies disabled

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