comp.lang.ada
 help / color / mirror / Atom feed
* Enumeration literals and their associated functions
@ 2005-10-20 14:21 Maciej Sobczak
  2005-10-20 15:35 ` Frank J. Lhota
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Maciej Sobczak @ 2005-10-20 14:21 UTC (permalink / raw)


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);

    type Function_Access is access function return Color;

    Fa : Function_Access := RED'Access;

The compiler reports an error in the last line:

"prefix of "Access" attribute cannot be enumeration literal"

I understand that the use of "RED" in this line is not resolved to be a 
name of the function. If that is the case, then how can I use this function?

Another example:

Some_Function_That_Expects_Color(RED);

Is the use of "RED" above considered to be a function call? If yes, then 
why in RED'Access it is resolved to be a literal?
If instead "RED" above is considered to be a literal, then what's the 
sense of having an associated function at all?


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



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

end of thread, other threads:[~2005-11-30  6:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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