From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: Better way to fill Storage_IO? Date: Wed, 19 May 2021 10:26:24 +0200 Organization: A noiseless patient Spider Message-ID: References: <3cfe02b8-18d3-4673-b808-48ad29092517n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 19 May 2021 08:26:24 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="3294e74acc61672f724a4128636404d8"; logging-data="469"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AvR9E1B2kLV/4nvKNrQWS" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Cancel-Lock: sha1:otsj9aGFXJNv9pVS4QnvkBBoyCU= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62010 List-Id: Den 2021-05-19 kl. 09:17, skrev J-P. Rosen: > Le 18/05/2021 à 22:39, Simon Wright a écrit : >> so as well as the current ARM 13.13.2(4), for subtype S of type T >> >>     procedure S'Write( >>        Stream : not null access Ada.Streams.Root_Stream_Type'Class; >>        Item : in T) >> >> one could have for an object O >> >>     procedure O'Write( >>        Stream : not null access Ada.Streams.Root_Stream_Type'Class) >> >> but we don't, not even in Ada 202x. > For what benefit? Saving a few keystrokes? > The Integer'Image(An_Integer) changed to An_Integer'Image the Verb(Object, Parameter) changed to Object.Verb(Parameter) It does not have to save keystrokes, but it has to be more readable. More readable is of course in the eye of the beholder. package Coded_Values is type WCS_Next_Location_Type_Type is ( Reject_Position, Selection_Point, Transfer_Unit); end Coded_Values; with Coded_Values; with Text_Io; package Test is Next_Location : Coded_Values.WCS_Next_Location_Type_Type := Coded_Values.Selection_Point; Given the above I do prefer Text_IO.Put_Line ("Next is " & Next_Location'Image); over Text_IO.Put_Line ("Next is " & Coded_Values.WCS_Next_Location_Type_Type'Image(Next_Location)); or when a use clause is in effect Text_IO.Put_Line ("Next is " & WCS_Next_Location_Type_Type'Image(Next_Location)); even with a use clause I prefer the 'image on the variable. In my eyes Text_IO.Put_Line ("Next is " & Next_Location'Image); Is the better and more readable choice. That is likely the case of the analog stream discussion above. Syntax matter. If Ada is to grow it has to have a pleasant syntax, that is not perceived as clumsy or overly wordy. -- Björn