dropping parentheses on template instantiation

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Oct 5 13:21:20 PDT 2008


Steven Schveighoffer wrote:
> "Andrei Alexandrescu" wrote
>> I just realized something different. After making an informal review of 
>> some code, I saw that a large percentage of template instantiations only 
>> need ONE argument.
>>
>> This makes me think, with the old "!" notation, parentheses could be 
>> dropped entirely without prejudice:
>>
>> auto covariance = Matrix!real(n, n);
>> auto normalized = SparseVector!double(n);
>>
>> and so on.
>>
>> To the unbridled joy of the enemies of the Sad Pirate, the dot won't work 
>> for template instantiation because without the parentheses it DOES 
>> engender ambiguity.
>>
>> Now say we take the following route:
>>
>> 1) We find something different from shouting
>>
>> 2) We drop the parentheses for 1 argument
>>
>> That sounds like a possible winner. In this case the "#" becomes 
>> considerably more attractive, in fact very attractive exactly because it 
>> looks unlike any letter:
>>
>> auto covariance = Matrix#real(n, n);
>> auto normalized = SparseVector#double(n);
>>
>> Ideas?
> 
> Not loving the missing parens.  Also I still like ! more than #.

Me too especially since I discovered # creates problems with #line.

> I guess this is off topic, but aren't there more important problems to solve 
> with the D language?

Well I think world hunger will have higher priority still. I have no 
idea how people choose what to work on at any given time, but I know 
it's hard to predict and hard to channel.

> I appreciate that you work with templates so much, but 
> to change all of this based on a non-popular subjective opinion, without any 
> technical advantage seems like a waste of resources and time (indeed, I feel 
> many minutes of my life have been lost on this thread).  I feel like I must 
> respond for my vote to be counted, but this seems like a very unimportant, 
> very specific bicycle shed color.

Well I think it's not fair to frame this as a "me" vs. "we" issue. It 
looks like quite a few people also have similar misgivings about the 
bang syntax. Moreover, this thread seem to actually bring even more 
interesting ideas to the fore. As far as popularity goes, the Sad Pirate 
turned out to be unpopular, and a few good point against it were being 
made. In the process of expressing that dislike, many people also 
revealed they didn't like the Slashed-Eye Sad Guy either and looked for 
alternatives.

> Like Jarrett, I believe there's probably not much I can do about it, since 
> you have your mind so tightly gripped on this shouting thing that it will 
> probably be changed in spite of all the resistance to it.

Probably this needs saying - I'd never plan to leverage my being close 
to Walter into introducing whatever change "just because I so want". 
Also, Walter is smarter than accepting that to start with. If that's 
part of your irritation about the whole discussion, I'm telling you you 
can safely discount it.


Andrei



More information about the Digitalmars-d mailing list