Constants, Aliases

Chris Nicholson-Sauls ibisbasenji at gmail.com
Thu Dec 14 21:02:39 PST 2006


Bill Baxter wrote:
> nazo wrote:
>> Expressions! Expressions!  (/ ~.)/
>>
>> I think that the exchange of parameters of alias is necessary from:
>>   alias (x*2) exp;
>> to:
>>   alias exp=x*2;
> 
> I'm all for that.  Changing the order I mean, not necessarily aliases 
> for expressions.  Typedef too.  They're all just saying symbol=value 
> (where 'value' is a type).  But probably it will never change.  Alias is 
> too closely connected to typedef, and typedef is too closely connected 
> to C/C++ for Walter to change its syntax.  End result: neither will change.
> 
>> And I need alias arguments as syntax sugar like:
>>   alias(alias i) exp=i*2;
>> same as:
>>   template exp(alias i){
>>     alias exp=i*2;
>>   }
> 
> Hmm, yeh not sure about that.  Have to get everyone to swallow the 
> expression alias idea first, which will be tough because they've all 
> been brainwashed into thinking that #define is the 8th deadly sin.  :-P
> 
> --bb

Actually its the 9th deadly sin.  The 8th would be copy constructors.  That said, i'm 
actually intrigued by the idea of a expression aliases.  I can think of ways they might 
well be useful -- and I think changing the syntax to "'alias' ident '=' expr ';'" for this 
particular case wouldn't be too bad either.  (If nothing else it would make it perfeclty 
clear to a parser that this is an expression-alias rather than a symbol-alias.)

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list