From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Unbounded_String'Write et al in GNAT Date: Tue, 14 Nov 2017 15:05:19 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="e23944c4eebbfc39fa1beb448f50b8b8"; logging-data="6846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ql7Nz+39HzlCntn85+7vRUpYAvZXCij8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:lvjRJEeHxLwCJNRbXGi+QTf4U0Y= sha1:+aZsQFU4KAST5AZ7o00/jgKbVm8= Xref: feeder.eternal-september.org comp.lang.ada:48884 Date: 2017-11-14T15:05:19+00:00 List-Id: Victor Porton writes: > GNAT has > > for Unbounded_String'Write use Unbounded_String_Write; > for Unbounded_String'Read use Unbounded_String_Read; > for Unbounded_String'Output use Unbounded_String_Write; > for Unbounded_String'Input use Unbounded_String_Input; > > in package Ada.Strings.Unbounded. > > Ada2012 seems not to provide them. > > Is it standard conformant? > > Or better, should we add this to the standard? No. ARM 13.13.2(2)ff [1] says For every subtype S of a specific type T, the following attributes are defined. S'Write S'Write denotes a procedure with the following specification: procedure S'Write( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in T) S'Write writes the value of Item to Stream. S'Read S'Read denotes a procedure with the following specification: procedure S'Read( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out T) S'Read reads the value of Item from Stream. And (18) says much the same about 'Output, 'Input. So Unbounded_String _must_ support 'Read, 'Write, 'Output, 'Input, but it's up to the compiler vendor to implement them, which GNAT does *in* *the* *private* *part* - which is exactly the way the standard expects any other vendor to do it. The ARG goes to a lot of trouble to ensure that a vendor can implement the standard's requirements. [1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-13-13-2.html#p2