comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Enumeration literals and their associated functions
Date: Thu, 20 Oct 2005 16:21:26 +0200
Date: 2005-10-20T16:21:26+02:00	[thread overview]
Message-ID: <dj8955$epg$1@sunnews.cern.ch> (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/



             reply	other threads:[~2005-10-20 14:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-20 14:21 Maciej Sobczak [this message]
2005-10-20 15:35 ` Enumeration literals and their associated functions 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
replies disabled

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