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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 7 13:53:16 PDT 2008


Tomas Lindquist Olsen wrote:
> Vincent Richomme wrote:
>> Steven Schveighoffer a écrit :
>>>
>>> 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.
>>
>>
> 
> How is curly braces different here? I think of some scope when I see 
> them, certainly not template parameters.
> 
> I too thought wth? when I first read the D spec, but coming from C++ and 
> having hit the issues with <> several times it made a lot of sense to do 
> something else.
> 
> IMHO {} is not it!

IMHO {} is better than .+() (where ".+" is one or more characters). I 
remember better now when I first talked to Walter about template 
instantiation. We were just talking about problems with <> and I asked, 
how do you avoid that in D? (We were in a coffee shop.) He said "Well," 
pulled a napkin and wrote the aeternal foo, followed by "!", followed by 
"(bar)". I thought and said it sucked and he gave me the "you'll get 
used to it" cookie. Had he said "Oh, I just use curly braces", I 
would've been like, "alright". There wouldn't have been a need to even 
write anything or add anything to it.

Andrei



More information about the Digitalmars-d mailing list