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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8623fab5750cd6aa X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!news-out.ntli.net!newsrout1.ntli.net!news-in.ntli.net!ntli.net!newspeer1-win.server.ntli.net!newsfe1-win.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: Enum'Image (Was: Improving Ada's image) User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada References: <40b9c99e$0$268$edfadb0f@dread16.news.tele.dk> <1086715817.122983@master.nyc.kbcfp.com> <1086733411.736049@master.nyc.kbcfp.com> <40C85035.4020706@noplace.com> <40C9EC3B.60304@noplace.com> <40CD90A4.8030005@noplace.com> <40CEDCB5.9000509@noplace.com> <1087325485.307616@master.nyc.kbcfp.com> <1087488758.881520@master.nyc.kbcfp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Mon, 21 Jun 2004 17:06:35 +0100 NNTP-Posting-Host: 81.100.88.147 X-Complaints-To: http://www.ntlworld.com/netreport X-Trace: newsfe1-win 1087837574 81.100.88.147 (Mon, 21 Jun 2004 17:06:14 GMT) NNTP-Posting-Date: Mon, 21 Jun 2004 17:06:14 GMT Organization: ntl Cablemodem News Service Xref: g2news1.google.com comp.lang.ada:1743 Date: 2004-06-21T17:06:35+01:00 List-Id: On Mon, 21 Jun 2004 17:30:19 +0200, Jacob Sparre Andersen wrote: ... > That would probably be the best way to do it. It would keep old > programs working, and it seems like a logical Ada-like way of doing > things. > > type Colours is (Red, Green, Blue); > for Red'Image use "R"; > for Green'Image use "G"; > for Blue'Image use "B"; Potentially useful - but very verbose in the simple case. If it takes fifteen lines of code to declare an enumeration with nicely cased 'Image, the critics would have a field day! Keeping the representations and enumeration synced would be unnecessary work. Something to say "use the names spelled as I spell them" is needed. pragma Enum_Image_Case (Colours, Verbatim|Upper|Lower|...); Of course, if we had had Verbatim from the start, we could have use To_Upper, To_Lower if we wanted :( And I can't recall any situation where I wanted the case of the enumerations converted as the language specifies. -- Adrian Wrigley, Cambridge, UK.