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.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!icdoc!umace03 From: umace03@doc.ic.ac.uk (M Y Ben Gershon) Newsgroups: comp.lang.ada Subject: Re: Enumeration_IO Message-ID: <1871@gould.doc.ic.ac.uk> Date: 8 May 90 23:53:25 GMT References: <1846@sparko.gwu.edu> Sender: news@doc.ic.ac.uk Reply-To: umace03@doc.ic.ac.uk (M Y Ben Gershon) Organization: Imperial College Department of Computing List-Id: Newsgroups: comp.lang.ada Subject: Re: Enumeration_IO Summary: Expires: References: <1846@sparko.gwu.edu> Sender: Reply-To: umace03@doc.ic.ac.uk (M Y Ben Gershon) Followup-To: Distribution: Organization: Imperial College Department of Computing Keywords: In article <1846@sparko.gwu.edu> mfeldman@seas.gwu.edu (Mike Feldman) writes: >In preparing some programs for a book I am working on, I have gotten >interested in the idiosyncracies of Enumeration_IO. Specifically, the >PUT operations in this generic package are supposed to have a parameter >SET of type TYPE_SET, where TYPE_SET is (LOWER_CASE, UPPER_CASE). > >Well, consider an enumeration type > type COLORS is (red, blue, green); >and an instance > package COLOR_IO is new TEXT_IO.ENUMERATION_IO(ENUM => COLORS); >and a variable > C : COLORS := blue; >and an output operation > COLOR_IO.PUT(ITEM => C); > >All is well so far, everything compiles and runs except that the output >value is BLUE, because the default is Upper_Case. Now change the output >operation to > COLOR_IO.PUT(ITEM => C, SET => LOWER_CASE); > >Irvine Ada (HP835), IntegrAda (IBM-PC), VADS (Sun3) and AdaVantage (Sun3) >ALL bail out on a "LOWER_CASE is an undefined identifier" diagnostic. >Clearly something is going on here. According to LRM 14.3.9 this should be >allowed. Can anyone provide some enlightenment here? I can't claim to be an Ada expert, but altering it to the following: Color_IO.Put (Item => C, Set => Text_IO.Lower_Case); seems to work fine in AdaStudent. Alternatively, you could leave it unchanged and have a 'use Text_IO' at the top, after 'with Text_IO'. However, it doesn't quite seem to make sense, and if the following is tried: Color_IO.Put (Item => C, Set => Color_IO.Lower_Case); it doesn't work (as in the original example). Why this should be I cannot imagine, but when someone can explain it to us on the net, I'm sure we'll all have learned something about generic packages that we didn't know before. Michael Ben-Gershon umace03@doc.ic.ac.uk