shouting versus dotting

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Oct 5 07:05:03 PDT 2008


Lester L. Martin II 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 like the idea of '.' either. I currently like the '!'. I am
> not the best at templates and making templates similar to function
> call (looks like each other) would make templating so much harder. It
> should have something that lets you know right off that it's a
> template. Do you really want a template looking like a function.

You already have a template looking like a function. It works so well 
you don't even care, and consequently are not put off by it.

> That
> has potential to get confusing as your brain argues just at a glance
> over if a function is called and supplied parameters most functions
> wouldn't accept or is it a template and the list afterwards is the
> stuff supplied to the function (I don't remember ever passing to a
> function (real, real) so looking at that and having my brain think
> about "OH!" that's why the function call isn't working and the code
> won't compile, it's because you were dumb enough to supply types
> instead of values is not very intuitive).
> 
> I like the '!' and don't look forward to seeing it changed but if it
> was to be changed, I'd prefer it not to be a '.' but maybe something
> along the line of a colon (':') because it doesn't show a function
> call. I can't remember ever using a ':' in my code except for that
> import this : function2 type stuff so I think this would be a good
> idea versus the '.'

I prefer the colon too, if ambiguity with ?: can be taken care of.

Andrei



More information about the Digitalmars-d mailing list