shouting versus dotting

Sean Kelly sean at invisibleduck.org
Sun Oct 5 12:32:52 PDT 2008


Andrei Alexandrescu wrote:
> Jason House wrote:
>> Andrei Alexandrescu Wrote:
>>
>>> Jarrett Billingsley wrote:
>>>> On Sun, Oct 5, 2008 at 12:06 AM, Andrei Alexandrescu 
>>>> <SeeWebsiteForEmail at erdani.org> 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.
>>>>>
>>>>> In C, "!" is used as a unary operator. That may seem odd at
>>>>> first, but it nevers follows a word so it's tenuous to
>>>>> associate it with the natural language "!". In D, binary "!"
>>>>> _always_ follows a word, a name, something coming from natural
>>>>> language. So the conotation with exclamation jumps at you.
>>>>>
>>>>> That's why I find the choice of "!" poor. I believe it can
>>>>> impede to some extent acquisition of templates by newcomers,
>>>>> and conversely I believe that using .() can make templates more
>>>>> palatable. I tried using ".()" in my code and in only a couple
>>>>> of days it looked and felt way better to me. Based on that
>>>>> experience, I suggest that "!()" is dropped in favor of ".()"
>>>>> for template instantiation for D2.
>>>>>
>>>>> Sean's argument that "The exclamation mark signifies an
>>>>> assertion of sorts" is exactly where I'd want templates not to
>>>>> be: they should be blended in, not a hiccup from normal code.
>>>>> Serious effort has been, and still is, made in D to avoid
>>>>> shell-shocking people about use of templates, and I think ".()"
>>>>> would be a good step in that direction.
>>>> Long argument short:  I don't mind !() at all, and changing it to
>>>> .() seems like a pointless pedanticism.  But since you're the one
>>>>  suggesting it, there's a very good chance of it getting into the
>>>>  language (if it hasn't already), so there's not much use arguing
>>>>  against it.
>>> It won't make it unless others try it and find it palatable too.
>>> But please let's try it first.
>>>
>>> Also, I'm much less keen on introducing .() than on ousting !(),
>>> which I believe was a very poor choice. So I suggest we all explore
>>> other syntax choices until we find something that we can show to
>>> the world with a straight face.
>>>
>>>
>>> Andrei
>>
>> I have no trouble telling the world about !(). It's simple and clean.
>> In fact, I already have told C++ folk about it when contrasting to
>> <>.
> 
> I see no shouting in "simple and clean". The <> syntax was 
> extraordinarily luring and of overwhelming popularity, to the extent 
> that the sirens' song blindsided most people about its inherent issues. 

Makes sense.  The <> syntax has a basis in mathematics.  Too bad it just 
doesn't work in practice.

> I'm glad people are considering {}. Maybe there is a way of ending this 
> conversation without shouting.

If this were an option, why did Walter originally choose !()?


Sean



More information about the Digitalmars-d mailing list