Storage class consistency
Paul D. Anderson
paul.d.anderson.removethis at comcast.andthis.net
Sat Apr 5 13:06:57 PDT 2008
Robert Fraser Wrote:
> Okay, I know everyone wants to put "enum" to rest, but I just want an
> explanation for why "enum" was chosen in the facre of syntactic
> difficulties. In particular, what I mean is that for every other storage
> class the following is possible:
>
> public
> {
> int x = 5;
> float f = 7.0;
> }
>
> const
> {
> int x = 5;
> float y = 7.0;
> }
>
> ... but not with enum ...
>
> enum
> {
> int x = 5;
> float y = 7.0;
> }
>
> ... which instead must be used as ...
>
> enum int x = 5;
> enum float y = 7.0;
>
> I understand Walter probably thought it through and decided that this
> inconsistency was worth it to be able to use a confusing keyword, but
> these are the sort of reasons it's difficult for me to get excited about
> D2. Is there any particular reason this was thought unimportant?
I agree this is a problem but to me it is a syntax problem rather than a keyword problem. I'd like to see the syntax you described become available. If the problem with the syntax is a conflict with existing "enum" syntax then I think you make a strong case for a new keyword. IIRC, the favorite of the forum was "manifest".
Paul
More information about the Digitalmars-d
mailing list