Version 1.1.1.1 of ais/ai-00174.txt

Unformatted version of ais/ai-00174.txt version 1.1.1.1
Other versions for file ais/ai-00174.txt

!standard 13.13.02 (09)          96-11-16 AI95-00174/00
!class confirmation 96-11-16
!status received 96-11-16
!priority Low
!difficulty Easy
!subject Are 'Read and 'Write guaranteed to be "inverses" for predefined types?
!summary 96-11-16
!question 96-11-16
!response 96-11-16
!appendix

!section 13.13.2(09)
!subject Are 'Read and 'Write guaranteed to be "inverses" for predefined types?
!reference RM95-13.13.2(9)
!from Norman Cohen
!reference 96-5750.a Norman H. Cohen 96-11-7>>
!discussion

Recently, as I wrote a program making use of Unbounded_String'Read and
Unbounded_String'Write, it occurred to me that I might be treading on thin
ice.

13.13.2(1) makes clear the intention that if T'Write disassembles a given
object of type T into a byte stream, T'Read will reconstruct an equivalent
object.  However, this is not expressed formally.  I see two loopholes that
ought to be closed by a confirmation:

13.13.2(9) says, "For elementary types, the representation in terms of
stream elements is implementation defined."  This implies, but does not
state explicitly, that there IS a unique stream-element representation for
a value of an elementary type T, that T'Write generates this
representation, and that T'Read constructs a value from this
representation.  (In contrast, the paragraph goes on to describe the
behavior of 'Read and 'Write for composite types operationally, in terms of
the behavior of these procedures, rather than structurally, in terms of the
contents of the stream.)

Nothing is said about whether an implementation can override the predefined
PT'Read or PT'Write for a private type PT declared in a predefined package
(presumably it can) or whether it is guaranteed that PT'Read reconstructs
an object with the same behavior as the object that PT'Write disassembled
(presumably it is, which means that for some representations of private
types, the predefined 'Read and 'Write MUST be overridden).

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

Questions? Ask the ACAA Technical Agent