Another foolish idea for manifest constants
Bruce Adams
tortoise_74 at yeah.who.co.uk
Sat Dec 8 16:26:12 PST 2007
On Sun, 09 Dec 2007 00:03:01 -0000, Robert Fraser
<fraserofthenight at gmail.com> wrote:
> Bruce Adams wrote:
>> A 'manifest' constant is one that is never allowed to use any storage.
>> There is
>> one 'type' for which this is already true - void.
>> So how about:
>> void int x = 3;
>> This is a non-breaking change as using void this way is a syntax error.
>> Granted void is not a storage class.
>
> I don't think that's any better than "enum". And if it's used to infer
> type as in:
>
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.
> 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";
More information about the Digitalmars-d
mailing list