comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: When enumeration representation clause is too late?
Date: Mon, 18 Aug 2014 10:47:23 -0600
Date: 2014-08-18T10:47:23-06:00	[thread overview]
Message-ID: <C6qIv.457591$ic5.241196@fx21.iad> (raw)
In-Reply-To: <lss22e$teg$1@dont-email.me>

On 17-Aug-14 23:13, J-P. Rosen wrote:
> Le 17/08/2014 23:38, Victor Porton a écrit :
>> When enumeration representation clause is too late and so must be
>> disallowed?
>>
>>  From compiler writer's perspective, it is clear that enumeration
>> representation clause should not be after calling an enum value.
>>
>> But I have not found such a rule in the ARM-2012.
>>
> A representation clause on a type is not allowed after the type is frozen.
>
> Freezing rules are described in 13.14. Advice: choose a good arm-chair
> and grab a mug of coffee before you start reading this paragraph.

One thing that would be kind of nice is a "deferred" aspect which would 
allow the representation of an enumeration to be specified in the 
private section. -- This would allow the grouping of types and subtypes 
w/o having to intersperse representation clauses between them and also 
keep them in the private section where I believe is their proper place.

NOT CURRENTLY LEGAL ADA:

     Package K is
         Type Device_States is ( Missing, Standby, Ready, Unknown )
         with Deferred;

         Subtype Integrated_Device is Device_States range Standby..Unknown;

     Private
         For Device_States use (
             Missing	=> 2#000#,
             Standby	=> 2#100#,
             Ready	=> 2#101#,
             Unknown	=> 2#111#
           );
     End K;

      reply	other threads:[~2014-08-18 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 21:38 When enumeration representation clause is too late? Victor Porton
2014-08-18  5:13 ` J-P. Rosen
2014-08-18 16:47   ` Shark8 [this message]
replies disabled

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