comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Unbounded_String'Write et al in GNAT
Date: Tue, 14 Nov 2017 15:05:19 +0000
Date: 2017-11-14T15:05:19+00:00	[thread overview]
Message-ID: <lyzi7oew9c.fsf@pushface.org> (raw)
In-Reply-To: oud565$403$1@gioia.aioe.org

Victor Porton <porton@narod.ru> 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

  parent reply	other threads:[~2017-11-14 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 22:09 Unbounded_String'Write et al in GNAT Victor Porton
2017-11-13 22:15 ` Victor Porton
2017-11-14 15:05 ` Simon Wright [this message]
2017-11-15 22:34   ` Randy Brukardt
replies disabled

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