comp.lang.ada
 help / color / mirror / Atom feed
* Re: calenday (was Re: IBM Acquires Rational Ada
@ 2002-12-17  5:47 Grein, Christoph
  2002-12-17 14:43 ` Robert A Duff
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Grein, Christoph @ 2002-12-17  5:47 UTC (permalink / raw)


RM 13.4(8) For nonboolean enumeration types, if the coding is not specified for 
the type, then for each value of the type, the internal code shall be equal to 
its position number.

So your proposal is superfluous.

And there is no global agreement whether the week starts with Sunday or Monday. 
Historically, it starts with Sunday, but there are countries where it starts 
with Monday.

> >>> type day_name_type is (mon,tue,wed,thu,fri,sat,sun);
> >>> 
> >>> Add a representation clause to guarantee that the values
> >>> start with sun => 0, mon => 1 etc.  For some code, it is
> >>> much easier to work with the day of the week in the form
> >>> of a number.
> >> 
> >> I'm puzzled by this advice.
> >> 
> >> day_name_type'Pos(mon) .. day_name_type'Pos(sun)
> >> 
> >> is necessarily 0 .. 6, is it not?
> >> 
> > Yes, the _pos_ attribute is defined by the language as you state,
> > but Warren is looking to have the _representation_ specified in
> > the package specification.  This insures that instantiations of
> > Ada.Unchecked_Conversion between day_name_type and
> > integer types produce specified results.
> > 
> 
> Yes, but if what you want is "to work with the day of the week in
> the form of a number", why use Unchecked_Conversion when
> day_name_type'Pos does what you want without further ado?



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-01-05 17:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-17  5:47 calenday (was Re: IBM Acquires Rational Ada Grein, Christoph
2002-12-17 14:43 ` Robert A Duff
2002-12-17 21:35   ` Wes Groleau
2002-12-18  2:09     ` Robert A Duff
2002-12-18  6:32       ` Dennis Lee Bieber
2002-12-18 18:33       ` Wes Groleau
2002-12-18 21:04         ` Larry Kilgallen
2002-12-18  9:10   ` Anders Wirzenius
2002-12-17 20:48 ` Dennis Lee Bieber
2002-12-18 14:52   ` Ted Dennison
2002-12-18 20:19     ` Dennis Lee Bieber
2002-12-18 14:23 ` Karel Miklav
2003-01-05 17:05   ` Locale package (Was: calenday) Jacob Sparre Andersen

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