Constants, Aliases

nazo lovesyao at gmail.com
Thu Dec 14 18:40:17 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.
void unyu(){writefln("unyu");};
alias[] funcs=[unyu,unyu,unyu];
foreach(f;funcs)f();
>> 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. 
I rewrite this idea:
current:
   template f(alias i){
     const int f=i*10;
   }
suggestion of syntax sugar:
   const int f(alias i)=i*10;
> 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
the preprocessor is the 8th deadly sin! but alias and template are not 
bad-knowhow!



More information about the Digitalmars-d mailing list