const again

Sean Kelly sean at f4.ca
Fri Dec 7 05:37:19 PST 2007


Walter Bright wrote:
> Sean Kelly wrote:
>> Walter Bright wrote:
>>> Ary Borenszweig wrote:
>>>> Why not
>>>>
>>>> macro x = 3;
>>>> ?
>>>
>>> It's been suggested several times. It doesn't make much aesthetic 
>>> sense to do things like:
>>>
>>>     macro int x = 3;
>>
>> So are you saying that it would be fine without the type qualifier, or 
>> that you don't like the use of "macro" here at all?
> 
> Since the optional type qualifier should be supported, it doesn't make 
> sense.

It may be stretching the desire to use "macro" too far, but casting 
could be used to specify the type:

macro x = 5L; // long int
macro y = cast(short) 2;
macro z = "abc"w;

Thus it wouldn't actually be treated like a storage class.  That might 
also save some confusion for things like:

enum const static int x = 7;



More information about the Digitalmars-d mailing list