comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <nobody@nowhere.fi>
Subject: Re: Enumeration literals and their associated functions
Date: Thu, 20 Oct 2005 20:03:04 +0300
Date: 2005-10-20T20:03:04+03:00	[thread overview]
Message-ID: <D6Q5f.3855$Yx5.800@reader1.news.jippii.net> (raw)
In-Reply-To: <dj8955$epg$1@sunnews.cern.ch>

Maciej Sobczak wrote:
> Hi,
> 
> <http://www.adaic.org/standards/95aarm/html/AA-3-5-1.html>, paragraph 6 
> states that for each enumeration literal specification there is an 
> appropriate parameterless function declated.
> 
>    type Color is (RED, GREEN, BLUE);
> 
> ...
> If instead "RED" above is considered to be a literal, then what's the 
> sense of having an associated function at all?

I believe that the LRM defines enumeration literals as functions 
because this automatically defines their overloading. That is, you 
can have another enumeration type that also has the literal RED (a 
synonym), yet overloading lets the compiler resolve which RED is 
meant, by the context.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  parent reply	other threads:[~2005-10-20 17:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-20 14:21 Enumeration literals and their associated functions Maciej Sobczak
2005-10-20 15:35 ` Frank J. Lhota
2005-10-20 19:26   ` Simon Wright
2005-10-20 16:17 ` Dmitry A. Kazakov
2005-10-20 17:03 ` Niklas Holsti [this message]
2005-10-20 22:10   ` Randy Brukardt
2005-10-20 22:59     ` Robert A Duff
2005-10-21  3:10       ` Larry Kilgallen
2005-10-21  4:57       ` Jeffrey R. Carter
2005-11-30  6:07         ` adaworks
replies disabled

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