comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Enumeration representation enhancement proposal
Date: 19 Oct 2004 16:55:18 +0200
Date: 2004-10-19T13:32:21+00:00	[thread overview]
Message-ID: <rlswtxmdag9.fsf@jacob.crs4.it> (raw)
In-Reply-To: pan.2004.10.15.11.06.42.353885@power.com.pl

Wojtek Narczynski wrote:

> >> Maybe this could be improved in Ada 2005? For example:
> >> 
> >> type Mix_Code is (Red, Green, Blue, Grey);
> >> 
> >> --  Modest proposal
> >> 
> >> for Mix_Code use (Red => 1, Green => 2, Blue => 3, Grey => others);
> >> 
> >> This should be relatively straightforward to implement, and would
> >> cover most needs.
> > 
> > The problem with this proposal it that (actual) values of the type
> > would no longer satisfy the ordering criteria (that a machine < or
> > > test will always have the same result as the corresponding
> > canonical test).
> 
> I don't follow, could you provide a sample Ada code which would be
> problematic?

  for Colours use (Red => 1, Green => 2, Blue => 4, Muddy => others);

  if Muddy < Blue then
     --  Do we ever get here?  Both 3 and 5 represents Muddy.  The one
     --  is smaller than 4 (which represents Blue), the other one
     --  isn't.  end if;
  end if;

Greetings,

Jacob
-- 
"Only Hogwarts students really need spellcheckers"
                                -- An anonymous RISKS reader



  reply	other threads:[~2004-10-19 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14  9:31 Enumeration representation enhancement proposal Wojtek Narczynski
2004-10-14 17:47 ` Nick Roberts
2004-10-15 11:06   ` Wojtek Narczynski
2004-10-19 14:55     ` Jacob Sparre Andersen [this message]
2004-10-20  8:41       ` Wojtek Narczynski
2004-10-20  8:58         ` Jacob Sparre Andersen
2004-10-20 11:04           ` Wojtek Narczynski
replies disabled

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