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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.109.59.4.58.mobile.3.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Fri, 01 Sep 2017 19:53:33 +0200 Organization: JSA Research & Innovation Message-ID: <87inh29ug2.fsf@jacob-sparre.dk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: franka.jacob-sparre.dk; posting-host="109.59.4.58.mobile.3.dk:109.59.4.58"; logging-data="22176"; mail-complaints-to="news@jacob-sparre.dk" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:XaDkg6clnumQ8uJXgFrltfUt3Uk= Xref: news.eternal-september.org comp.lang.ada:47880 Date: 2017-09-01T19:53:33+02:00 List-Id: Björn Lundin wrote: > 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 One option, as Jean-Pierre suggests, is to write a suitable tool using ASIS. Another option is to make your Data_Type type implement a "Visitor" interface, and go that way. I would usually suggest writing an ASIS-based tool, but I can easily find a champion for using the "Visitor" pattern as well. Greetings, Jacob -- »A corollary of Murphy's law is that duplicate information eventually becomes different information. Putting both in the same file may slow down the process, but it will not prevent it.« -- Wes Groleau