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

Vincent Richomme forumer at smartmobili.com
Tue Oct 7 11:03:14 PDT 2008


Steven Schveighoffer a écrit :
> "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.
> 
> 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.
> 
I agree I was shocked by the syntax at first glance ... and it still 
very difficult to read D templates. Hope I will get used to it ;-)
But if you ask lots of developpers what is the meaning of this symbol I 
am quite sure they will never imagine it could be related to templates.


> 2. They have no background in templates, and they say 'What's a template?'
> 
> Now, change the template syntax to {} or @() or whatever (clearly not <>, as 
> there are technical problems with it):
> 
> 1. User comes from Java/C++/C#/etc., has the same initial reaction 'Why is 
> this different?  Why make things different than C++ or whatever since 
> everything else looks like C++?', then they read the explanation and either 
> get defensively angry, or grasp the reasoning and move on.  Again, guessing 
> the latter will be more common.
> 
> 2. They have no background in templates, and they say 'What's a template?'
> 
> Bottom line, I believe it matters not in the least what syntax is used. 
> Templates are a hard concept to grasp to those who have never used them, 
> regardless of the syntax.
> 
> Just my view.  Note I can't speak for others that said they were put off by 
> the !() syntax, but at least that's how I interpreted what they meant.
> 
> -Steve 
> 
> 




More information about the Digitalmars-d mailing list