Version 1.1 of acs/ac-00313.txt

Unformatted version of acs/ac-00313.txt version 1.1
Other versions for file acs/ac-00313.txt

!standard 3.5.1(11)          19-01-04 AC95-00313/00
!standard 4.1(11/2)
!class confirmation 19-01-04
!status received no action 19-01-04
!status received 18-11-29
!subject Evaluation of enumeration literals
!summary
!appendix

From: Randy Brukardt
Sent: Thursday, November 29, 2018  11:42 PM

In looking at (and splitting) the proposed AI for user-defined literals, it
stuck me that there is no text in 4.2 for evaluation of character literals.
After some pondering, I concluded that's because they are always enumeration 
literals (at least until aspect Character_Literal gets defined; but we 
decided that won't be in Ada 2020). So they would share the rule for 
evaluating those. 

So of course I went to look for a definition of evaluating an enumeration 
literal. But there's nothing about that in 3.5.1 or 4.1 or 4.2 or 4.4. And
the index (which supposedly indexes "evaluation" everywhere)) doesn't 
mention evaluating an enumeration_literal.

I suppose the wording of 4.1(11/2) sort of answers the original question.
But the result of the evaluation seems missing here (it says that the 
evaluation "has no effect", so it apparently has no result, either); 4.4(10) 
covers the object case, but nothing seems to say that the result of 
evaluating a value is that value (you have an entity, not a value).

Have I missed something, or is this just missing? Obviously, no one really 
doubts what the evaluation of an enumeration_literal does, so there's no rush 
to fix this. So if it is truly missing, I'll just put it into
AI12-0066-1 (the AI of things that we don't intend to fix anytime soon -- 
this would be the seventh such item). Alternatively we could just hope that
the object/value unification (AI12-0270-1) would clean up this problem; of 
course that might never happen either.

***************************************************************

From: Gary Dismukes
Sent: Friday, November 30, 2018  12:48 PM

...
> I suppose the wording of 4.1(11/2) sort of answers the original question.
> But the result of the evaluation seems missing here (it says that the 
> evaluation "has no effect", so it apparently has no result, either); 
> 4.4(10) covers the object case, but nothing seems to say that the 
> result of evaluating a value is that value (you have an entity, not a value).

Given that enumeration_literals denote functions, doesn't the evaluation 
simply follow from the semantics of function calls?  Once we have that, the
result of evaluating follows from 3.5.1(11):

11 When called, the parameterless function associated with an enumeration 
literal returns the corresponding value of the enumeration type.

***************************************************************

From: Tucker Taft
Sent: Friday, November 30, 2018  4:10 PM

An enumeration literal is a parameterless function, and calling it returns the 
corresponding value of the enumeration type.  See 3.5.1(11).

***************************************************************

Questions? Ask the ACAA Technical Agent