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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.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: How to get Ada to ?cross the chasm?? Date: Wed, 9 May 2018 11:27:50 +0200 Organization: A noiseless patient Spider Message-ID: References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <16406268-83df-4564-8855-9bd0fe9caac0@googlegroups.com> <87o9i2pkcr.fsf@nightsong.com> <87in88m43h.fsf@nightsong.com> <87efiuope8.fsf@nightsong.com> <322f9b26-01de-4753-bb50-6ef2f3d993d8@googlegroups.com> <87a7th9pd1.fsf@nightsong.com> <87h8no1nli.fsf@nightsong.com> <87po2cyty7.fsf@nightsong.com> <87bmdwhwob.fsf@nightsong.com> <6746d7d1-406e-4891-8293-9424aed76215@googlegroups.com> <877eoezy6e.fsf@nightsong.com> <87y3gun1ha.fsf@nightsong.com> <87603yy0wr.fsf@nightsong.com> <244b242a-09a8-48d2-918b-77e9b171098f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 9 May 2018 09:27:48 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="392765172b320dde5eaf8c9d1c414ea5"; logging-data="24472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dfLTNCqsSHQGOu1ifclKE" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Cancel-Lock: sha1:kR7W/SKb2zTLLL7x5GfM1dsnjtE= Xref: reader02.eternal-september.org comp.lang.ada:52153 Date: 2018-05-09T11:27:50+02:00 List-Id: On 2018-05-08 22:24, J-P. Rosen wrote: > Le 08/05/2018 à 22:12, Randy Brukardt a écrit : >>> My mistake: I thought Value'Image was Ada 2012, but it seems to be a >>> Ada 2020 feature put early into GNAT. > > Anyway, it's just a minuscule improvement to writing, with no new > feature and no benefit in reading. I disagree. It is more than that I affects 'with' statments sometimes. And it makes the code look better/easier to read Below an uncompiled exsample of * old ways nees more 'withs' - which may affect elaboration order * makes the code harder to read -------------------- package Core_Types is type Handling_Unit_System_Status_Type is (Auto, Semi_Auto, Out_Of_System); type Assignment_Result_Type is (Success, Failure, Severe_Failure); type Assignment_Identity_Type is 1 .. 99_999; end Core_Types; -------------------- -------------------- with core_types; package Trp_Assignments is type Assignment_type is record Assignment_Identity : core_types.Assignment_Identity_Type ; Assignment_Result : core_types.Assignment_Result_Type; Handling_Unit_System_Status: core_types.Handling_Unit_System_Status_Type ; end record; ------------------------------------------- with core_types; -- ONLY NEEDED FOR do_stuff_old_way package body Transport_Handler is procedure do_stuff_old_way(Asm : Trp_Assignments.Assignment_type) is begin -- NEED THE 'with core_types' log("id" & core_types.Assignment_Identity_Type'Image( Asm.Assignment_Identity) & " " & "result " & core_types.Assignment_Result_Type'image( Asm.Assignment_Result) & " " & "status " & core_types.Handling_Unit_System_Status_Type'Image( Asm.Handling_Unit_System_Status)); end do_stuff_old_Way; procedure do_stuff_new_way(Asm : Trp_Assignments.Assignment_type) is begin -- DOES NOT NEED THE 'with core_types' log("id" & Asm.Assignment_Identity'Image & " " & "result " & Asm.Assignment_Result'Imgaer & " " & "status " & Asm.Handling_Unit_System_Status'Image); end do_stuff_new_Way; end Trp_Assignments; > Use the good ol' T'image(v), and don't worry about versions Not when can be avoided - for me anyway -- -- Björn