Version 1.4 of ai12s/ai12-0354-1.txt

Unformatted version of ai12s/ai12-0354-1.txt version 1.4
Other versions for file ai12s/ai12-0354-1.txt

!standard 5.5.1(21/3)          20-06-16 AI12-0354-1/02
!class Amendment 20-01-10
!status Amendment 1-2012 20-06-16
!status WG9 Approved 22-06-22
!status ARG Approved 11-0-2 20-06-13
!status work item 20-01-10
!status received 19-11-18
!priority Low
!difficulty Easy
!subject Semantics of Parallel_Iterators
!summary
It is erroneous if a parallel iterator does not return cursors that identify distinct elements.
!problem
We don't have any requirement that the cursors return by First/Next for a Parallel_Iterator identify distinct elements. If that is not true, then parallel operations on a result cursor can lead to data races and erroneous execution.
!proposal
(See Summary.)
!wording
Add after 5.5.1(21/3):
Erroneous Execution
A call on the First or Next operation on a given Parallel_Iterator object with a given Chunk value, which does not propagate an exception, should return a Cursor value that either yields False when passed to Has_Element, or that identifies an element distinct from any Cursor value returned by a call on a First or Next operation on the same Parallel_Iterator object with a different Chunk value. If the First or Next operations with a Chunk parameter behave in any other manner, execution is erroneous.
!discussion
We follow the model of storage pools here, and declare an implementation that fails to return cursors that designate distinct elements erroneous. Using such cursors are likely to be erroneous anyway, so this is not really introducing a new kind of erroneousness.
!corrigendum 5.5.1(21/3)
Insert after the paragraph:
This function (if any) is the default variable indexing function for T.
the new paragraph:
Erroneous Execution
A call on the First or Next operation on a given Parallel_Iterator object with a given Chunk value, which does not propagate an exception, should return a Cursor value that either yields False when passed to Has_Element, or that identifies an element distinct from any Cursor value returned by a call on a First or Next operation on the same Parallel_Iterator object with a different Chunk value. If the First or Next operations with a Chunk parameter behave in any other manner, execution is erroneous.
!ASIS
No ASIS effect.
!ACATS test
Erroneous execution is untestable.
!appendix

From: Tucker Taft
Sent: Saturday, November 16, 2019  2:13 PM

We should probably establish a requirement that the First/Next routines 
of parallel iterators that take a "chunk" parameter produce a sequence 
of Cursor values for a given chunk index that are non-overlapping with 
those produced by the First/Next routines for any other in-range chunk index 
value.  Currently there is no dynamic semantics for these routines in 5.5.1.
I might suggest the following, modeled after how Storage_Pool operations are 
described:

   Erroneous Execution

A call on the First or Next operation on a given Parallel_Iterator object 
with a given Chunk value, which does not propagate an exception, should return 
a Cursor value that either yields False when passed to Has_Element, or that 
identifies an element distinct from any Cursor value returned by a call on a 
First or Next operation on the same Parallel_Iterator object with a different 
Chunk value.  If the First or Next operations with a Chunk parameter behave 
in any other manner, execution is erroneous.

****************************************************************


Questions? Ask the ACAA Technical Agent