shouting versus dotting

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Oct 5 07:29:37 PDT 2008


KennyTM~ wrote:
> Christopher Wright wrote:
>> Andrei Alexandrescu wrote:
>>> Christopher Wright wrote:
>>>> Andrei Alexandrescu wrote:
>>>>> The problem I see with "!" as a template instantiation is not 
>>>>> technical. I write a fair amount of templated code and over years 
>>>>> the "!" did not grow on me at all. I was time and again consoled by 
>>>>> Walter than one day that will happen, but it never did. I also 
>>>>> realized that Walter didn't see a problem with it because he writes 
>>>>> only little template code.
>>>>>
>>>>> I didn't have much beef with other oddities unique to D. For 
>>>>> example, I found no problem accommodating binary "~" and I was 
>>>>> wondering what makes "!" different. I was just looking at a page 
>>>>> full of templates and it looked like crap.
>>>>>
>>>>> One morning I woke up with the sudden realization of what the 
>>>>> problem was: the shouting.
>>>>
>>>> Not only that, but typing it is annoying. First you need to put the 
>>>> right pinky on the shift key, which is a long reach; then you need 
>>>> to put the left pinky on the 1 key, which is a long reach. Then you 
>>>> need to move your left pinky all the way back to the left shift key, 
>>>> which is a short reach, and move your right ring finger up to the 9 
>>>> key.
>>>>
>>>> It's a lot of reaching and back and forth.
>>>>
>>>> But I don't favor '.' since it's already used.
>>>
>>> I don't favor "." any more than the next guy, but I am glad there is 
>>> awareness of how unfit a choice "!" is. If you have any ideas, please 
>>> post them! Ah! I! Exclaimed! Again!
>>>
>>> Andrei!
>>
>> I agree with Mr. Martin II: colon might be an unambiguous option, and 
>> for qwerty keyboards, you don't have to switch shift keys. (I use 
>> dvorak, so it'd be slightly more awkward, but still a fair bit more 
>> easier than a bang.)
>>
>> Also, colon's taller than dot, so it's easier to see.
> 
> How to distinguish a label from a template then? Should I print X or Y 
> in the following code?
> 
> import std.stdio;
> 
> class X {
>     static void print () {
>         writeln("Y");
>     }
> }
> 
> template T (x) {
>     void print () {
>         writeln("X");
>     }
> }
> 
> void main () {
>     T:(X).print();
> }

Heh. So this change should come together with abolishing goto :o).

Andrei



More information about the Digitalmars-d mailing list