comp.lang.ada
 help / color / mirror / Atom feed
* When enumeration representation clause is too late?
@ 2014-08-17 21:38 Victor Porton
  2014-08-18  5:13 ` J-P. Rosen
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Porton @ 2014-08-17 21:38 UTC (permalink / raw)


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.

-- 
Victor Porton - http://portonvictor.org


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

* Re: When enumeration representation clause is too late?
  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
  0 siblings, 1 reply; 3+ messages in thread
From: J-P. Rosen @ 2014-08-18  5:13 UTC (permalink / raw)


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.

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr


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

* Re: When enumeration representation clause is too late?
  2014-08-18  5:13 ` J-P. Rosen
@ 2014-08-18 16:47   ` Shark8
  0 siblings, 0 replies; 3+ messages in thread
From: Shark8 @ 2014-08-18 16:47 UTC (permalink / raw)


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;

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

end of thread, other threads:[~2014-08-18 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox