comp.lang.ada
 help / color / mirror / Atom feed
* Static expression question
@ 2002-05-06 23:24 Vincent Marciante
  2002-05-07 10:45 ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Marciante @ 2002-05-06 23:24 UTC (permalink / raw)


Isn't the renaming of an enumeration literal as a function
supposed to be considered to be a static expression?

GNAT 3.14p and ObjectAda 7.2 give different results regarding 
the following code

 
procedure test_static_rename is
    type enum is (first_enum, last_enum); --[1]

    function renamed_last_enum return enum renames last_enum; --[2]
   
    enum_value : enum := last_enum;
begin
    case enum_value is
        when first_enum =>
            null;


        when renamed_last_enum => --[3]  legal?


            null;
    end case;
end;


I think that renamed_last_enum at [3] is supposed to be considered
to be a static expression due to the following:

At [3] there is a function call to renamed_last_enum and
 
  ARM 4.9(2)  A static expression is a scalar or string expression
              that is one of the following:
  <...>

  ARM 4.9(6)  a function_call whose function_name or function_prefix
              statically denotes a static function, and <...>


At [2] renamed_last_enum statically denotes enum_last as per

  ARM 4.9(14) A name _statically_denotes_ an entity if it denotes an
              entity and:
  <...>

  ARM 4.9(17) It denotes a renaming_declaration with a name that
              statically denotes the renamed entity.


At [1] enum_last is a static function as per

  ARM 4.9(18) A static function is one of the following:
  <...>

  ARM 4.9(21) an enumeration literal;


If my conclusion from the above is incorrect then I would like to 
know the correct ARM passages that apply.

Thanks in advance.


Vincent Marciante

(To reply directly, please r e m o v e  "_ r e m o v e" 
 from my email address.  Sorry for the inconvenience.)



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

* Re: Static expression question
  2002-05-06 23:24 Static expression question Vincent Marciante
@ 2002-05-07 10:45 ` Robert Dewar
  2002-05-08  3:15   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Dewar @ 2002-05-07 10:45 UTC (permalink / raw)


Vincent Marciante <marciant_remove@earthlink.net> wrote in message news:<3CD710A0.4743@earthlink.net>...
> Isn't the renaming of an enumeration literal as a function
> supposed to be considered to be a static expression?

My initial answer to this was no, but I agree that Vincent's exegesis
looks reasonable (leading to an answer of yes). This is certainly a
very delicate area of the language (what denotes what, and what is
static), and not one where I consider myself to be expert enough.
Hopefully we can get a reading here from Tuck, I will also ask
Gary Dismukes.



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

* Re: Static expression question
  2002-05-07 10:45 ` Robert Dewar
@ 2002-05-08  3:15   ` Robert Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Dewar @ 2002-05-08  3:15 UTC (permalink / raw)


dewar@gnat.com (Robert Dewar) wrote in message news:<5ee5b646.0205070245.1e70bd51@posting.google.com>...
> Vincent Marciante <marciant_remove@earthlink.net> wrote in message news:<3CD710A0.4743@earthlink.net>...
> > Isn't the renaming of an enumeration literal as a function
> > supposed to be considered to be a static expression?

Yes, this is static, and the latest version of GNAT accepts
it as static.



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

end of thread, other threads:[~2002-05-08  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06 23:24 Static expression question Vincent Marciante
2002-05-07 10:45 ` Robert Dewar
2002-05-08  3:15   ` Robert Dewar

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