dst = src rather than src dst

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Sep 5 06:08:44 PDT 2007


Bill Baxter wrote:
> Janice Caron wrote:
>> Please could D allow the following syntaxes
>>
>> alias dst = src;
>> typedef dst = src;
>>
>> Instead of (or as well as)
>>
>> alias src dst;
>> typedef src dst;
>>
>> I just prefer the destination on the left. Moreover, it would make for 
>> greater consistency throughout D. It would match up with assignment 
>> operators, module import renaming, and alias template specializations.
> 
> This has been suggested before.  I'm all for it.  Since types are just a 
> kind of value in the realm of compile time evaluation, it makes sense to 
> just have them use the same syntax.  It also puts the part you care 
> about (the symbol you're going to be using) right up front where it's 
> easy to find.  Actually that's the part I really care about.  I wouldn't 
> mind if the syntax used ':=' or something instead of '=', I'd just like 
> to see the order reversed.
> 
> --bb

I wouldn't be against it, at least as an alternative.  That said, though, I've always seen 
alias'es and typedef's as being declerations, only directly of a symbol.  In that case, 
they're fully consistant with other declerations taking the form 'TYPE SYMBOL'.  All about 
perspective, I guess.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list