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!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Fri, 1 Sep 2017 16:11:22 +0200 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 1 Sep 2017 14:06:58 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="c65b927ef56982e8670e91ac4367dc5e"; logging-data="22720"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NbIIJi+nUSVeEC3C8iq8p" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Cancel-Lock: sha1:gQsVnTzCHizScld52JYYKHzfDv0= Xref: news.eternal-september.org comp.lang.ada:47877 Date: 2017-09-01T16:11:22+02:00 List-Id: On 2017-08-03 07:45, Randy Brukardt wrote: > WG 9 requests the Ada community to submit enhancements to be considered for > inclusion in the next revision of Ada. Hi! I sometimes find the need to auto generate code from some kind of description. It would help quite a bit if there was a way to * iterate over fields in a record * query a field of its properties, like type, length if applicable type Data_Type is new Table_Utils.Root_Table_Type with record Bldid : Integer_4 := 0 ; -- Primary Key Bldsta : Integer_4 := 0 ; Bldtyp : Integer_4 := 0 ; Bldwei : Float_8 := 0.0 ; Blochei : Integer_4 := 0 ; Bwmsid : String(1 .. 35) := (others => ' ') ; -- non unique index 2 Bwmsldid : Integer_4 := 0 ; Xlocnam : String(1 .. 20) := (others => ' ') ; -- non unique index 3 Bcrets : Time_Type := Time_Type_First ; Bcartyp : Integer_4 := 0 ; Bcawei : Float_8 := 0.0 ; Bwanzone : Integer_4 := 0 ; Pulv : String(1 .. 3) := (others => ' ') ; Ixxlupd : String(1 .. 12) := (others => ' ') ; Ixxluts : Time_Type := Time_Type_First ; end record; Load : Data_Type; Here I'd like to do for Field of Load'Fields loop case Field.Data_Type is when Integer_4 => Text_io.Put_Line(Integer_4'Image(Field)); when Float_8 => Text_io.Put_Line(Formatted_Float_8.To_String(Field)); when Time_Type => Text_io.Put_Line(Cal.To_Iso_String(Field)); when String=> Text_io.Put_Line(Field & "-" & Field'Length'Img); when others => raise Not_Supported_Data_Type & Field.name; end case end loop; There is likely more info that would be nice to have, but The mentioned above would be great. -- -- Björn