foo!(bar) ==> foo{bar}

Ary Borenszweig ary at esperanto.org.ar
Tue Oct 7 10:06:57 PDT 2008


Steven Schveighoffer wrote:
> "Andrei Alexandrescu" wrote
>> Leandro Lucarella wrote:
>>> Jarrett Billingsley, el  6 de octubre a las 16:04 me escribiste:
>>>> On Mon, Oct 6, 2008 at 3:52 PM, Walter Bright
>>>> <newshound1 at digitalmars.com> wrote:
>>>>> The foo.(bar) syntax seems to be sinking. The foo{bar} seems to be the 
>>>>> most
>>>>> practical alternative. So, how about putting it in the next D2 release 
>>>>> on a
>>>>> trial basis, so people can try it out and see how it looks?
>>>>>
>>>> I guess it's OK but I still don't see why anything has to change.
>>>> There are much bigger fish to fry.
>>> Amen!
>> New/potential users are big fish. There has been quite a bit of opinion 
>> that the Slashed-Eye Sad Guy is offputting at least at first.
> 
> You might be misinterpreting how people on this NG have responded.  Here is 
> my anecdote (or at least what I can remember) when I first encountered D 
> templates.
> 
> I'm reading through the spec, and I get to templates, and they are specified 
> with !().  My first reaction is, well that's dumb, why buck the trend?  C++, 
> Java, C#, they all use <>, what gives?  Then I read the reasoning and I 
> totally understand it.  From that point on, !() looks sooo much better to me 
> than <>.  Never once did I not like the choice of !, it was all just a 
> knee-jerk reaction to why Walter didn't choose something that looks the same 
> as C++, especially when there are so many cases of him copying C++ syntax. 
> It could have been @() or {} and I still would have reacted the same.

Now that you mention it, making template syntax be !() or {} makes it 
harder to port C++ code to D. I wonder why this isn't a big deal, but 
keeping "int[3]*[5] x;"-like declarations is a must... :-(

> 
> My expectation for a new user to D is:
> 
> 1. The user comes from a Java/C++/C#/etc. background and has the same 
> initial reaction I had.  Then, depending on their personality, they get 
> defensively angry or say, 'oh yeah, that makes a lot of sense!' and are done 
> with it.  I'm guessing the latter would be more common.

The latter is what happened to me. But the !() syntax hurts my eyes, 
maybe because of what Andrei said about words and exclamations.



More information about the Digitalmars-d mailing list