Version 1.2 of ai12s/ai12-0235-1.txt

Unformatted version of ai12s/ai12-0235-1.txt version 1.2
Other versions for file ai12s/ai12-0235-1.txt

!standard 13.11(5)          17-06-09 AI12-0235-1/01
!standard 13.11.4(3/3)
!class Amendment 17-06-09
!status work item 17-06-09
!status received 17-06-09
!priority Low
!difficulty Easy
!subject Root_Storage_Pool should be pure
It is not possible to define a pool/subpool in a Pure package as Root_Storage_Pool is preelaborated. This prevents defining a shared pool type for use in the distributed program. (Note that, due to the prohibition on variables in distributed packages, a pool cannot itself be shared across partitions).
(See Summary.)
In 13.11(5) and 13.11.4(3/3), change Preelaborate to Pure.
[Question: Do we still need the pragma Preelaborable_Initialization in 13.11(6/2)?]
When Ada 95 was designed, neither Ada.Finalization nor System was declared Pure, so it would have been impossible to declare either of these packages Pure then. Nor were access types allowed.
Thus, there is no obvious reason (other than possibly breaking existing implementations) that these packages cannot be Pure.
OTOH, this seems to promise distribution that isn't actually possible. And the argument above could be applied to almost any package -- but forcing all language-defined packages to be Pure would make them almost unmaintainable.
No ASIS effect.
!ACATS test
An ACATS C-Test is needed to check that the new capabilities are supported.

!topic Storage-pools in distributed systems.
!reference Ada 202x RM13.11(5); RM13.11.4(3/3)
!from Edward Fish 17-05-21
!keywords DSA, storage-pools, purity

In the DSA (Annex E) there are references to accesses across partitions as well
as the categorization of library-units (E.2(6/3-6.5/3)); however the
package-interface defined in RM13.11 for System.Storage_Pools is Preelaborate
as is the Subpools child-package in 13.11.4. Nothing in those packages prevents
the contents from being declared pure and it may be advantageous to allow for
pools/subpools to be defined in pure units so that subpools may be defined for
every partition in the distributed program.

(Though it is admitted that you cannot create a pool/subpool in a pure unit,
due to the restriction on state, that is quite different than merely defining
the pool or subpool type.)


From: Tucker Taft
Sent: Tuesday, May 23, 2017  10:05 AM

I would agree that it would make sense to shift the categorization of both of
these packages from Preelaborate to Pure.  At one point Finalization was not
declared Pure, but that was changed.  Similarly, access types were not
permitted in Pure packages at one point, but now they are so long as they have
a storage size of zero, so I think both of these packages now can qualify as


From: Randy Brukardt
Sent: Thursday, November 30, 2017  6:50 PM

Here's a note for the author of AI12-0235-1 (that would be Tucker):

In Ada 2020, changing a package from Preelaborate to Pure potentially has more
consequences than just the categorization change, since the values of contract
aspects are specified differently for Pure packages by default.

For instance, changing:

package System.Storage_Pools is
    pragma Preelaborate (Storage_Pools);


package System.Storage_Pools with Pure is

is actually the same as:

package System.Storage_Pools with Pure, Nonblocking is

But this latter would be wildly incompatible, as all existing overridings of
Allocate/Deallocate would have to be changed to be Nonblocking. (One cannot 
override a Nonblocking => True subprogram with a Nonblocking => False, lest a
dispatching call violate the declaration's promise.) You actually need to
explicitly declare:

package System.Storage_Pools with Pure, Nonblocking => False is

in order to avoid any compatibility problem. (Note that AI12-0064-2 only
changes library units that require a change currently, which does not include
Storage_Pools, since Nonblocking defaults to False -- which is what we want --
for non-pure library units.)

I believe there is a similar issue for Global (or will be when it is finished),
since it defaults to Global => null for pure units and thus the root primitive


Questions? Ask the ACAA Technical Agent