Another foolish idea for manifest constants
Robert Fraser
fraserofthenight at gmail.com
Sun Dec 9 00:38:40 PST 2007
Bruce Adams wrote:
> I didn't say it was better just an alternative that hadn't be raised.
> I read void as meaning something like "nothing/none/does not exist" so
> its dictionary
> meaning fits.
> I am in the school that sees enums as a set (or list) of values and not
> a hack to
> declare constants.
I don't care about the dictionary definition, I'm concerned that enum
for manifest constants is syntactically different than other modifiers
in that it can't be used in blocks. This is unexpected behavior. The
word "enum[erate]" fits about as well as void, final, alias, etc., IMO.
>
>> void str = "hello";
>>
>> ... it becomes a semantic error.
>
> I don't see why. It could be changed to be a shorthand for:
>
> void auto str = "hello";
This is inconsistent. "void" is a type, not a storage class, so 'void
str = "hello"', the void will be parsed as a type, which the semantic
pass will have to rewrite as type inference. Other storage classes allow
type inference without any type being given.
More information about the Digitalmars-d
mailing list