comp.lang.ada
 help / color / mirror / Atom feed
From: umace03@doc.ic.ac.uk (M Y Ben Gershon)
Subject: Re: Enumeration_IO
Date: 8 May 90 23:53:25 GMT	[thread overview]
Message-ID: <1871@gould.doc.ic.ac.uk> (raw)
In-Reply-To: 1846@sparko.gwu.edu

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

  parent reply	other threads:[~1990-05-08 23:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-05-08  0:41 Enumeration_IO Mike Feldman
1990-05-08 16:38 ` Enumeration_IO Alex Blakemore
1990-05-08 18:32   ` Enumeration_IO Mike Feldman
1990-05-09 22:36     ` Enumeration_IO M Y Ben Gershon
1990-05-10  3:01       ` Enumeration_IO Mike Feldman
1990-05-08 23:53 ` M Y Ben Gershon [this message]
  -- strict thread matches above, loose matches on Subject: below --
1990-05-08 17:54 Enumeration_IO dritz
2000-04-06  0:00 Enumeration_IO NANCY HEHIR
2000-04-07  0:00 ` Enumeration_IO Jeff Carter
2000-04-07  0:00   ` Enumeration_IO Robert Dewar
2000-04-08  0:00     ` Enumeration_IO Jeff Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox