shouting versus dotting

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 6 09:56:08 PDT 2008


Alexander Pánek wrote:
> Benji Smith wrote:
>> Andrei Alexandrescu wrote:
>>> I'd want to give it a try. How do others feel about Template{arguments}?
>>
>>
>> At first glance, I like it better than !(), especially since it saves 
>> a character, making nested templates much nicer:
>>
>>    auto map = new Map{T[], List{MyType}}();     // not too bad
>>    auto map = new Map!(T[], List!(MyType))();   // not too good
>>    auto map = new Map<T[], List<MyType>>();     // still my favorite
>>
>> It's too bad the shift operators can't be changed. Personally, I think 
>> the angle brackets are more valuable as a matched pair of enclosures.
>>
>> We could redefine the shift operators to be:
>>
>>    -->  RIGHT SHIFT
>>    <--  LEFT SHIFT
>>    -->> SIGNED RIGHT SHIFT
>>
>> And then the angle brackets could be coopted for templates.
> 
> No way! :(
> ’em pointed brackets are way too pointy. I like having parenthesis for 
> templates.

Well another problem is we'd need to redefine the less-than and 
greater-than operators too.

Andrei



More information about the Digitalmars-d mailing list