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

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Oct 14 15:17:20 PDT 2008


Andrei Alexandrescu wrote:
> 
> One possibility to make progress would be to keep !( but allow omitting 
> the parens when only one argument is being passed. That way many 
> instantiations will be helped. For example, in wake of the impending 
> demise of complex built-ins:
> 
> Complex!double alpha;
> Complex!float[] data;
> 
> That way, again, we leverage the fact that an extra symbol is needed 
> instead of compulsively requiring it in addition of the parens.
> 
> One nice thing about this change is that it keeps all code as it is, 
> just lifts one restriction.
> 
> How about that?
> 
> 
> Andrei

*grrrnmhsdhmmrsrmmhsmgrrmhghhhgrhghrgg*...

Really, Andrei, what's this obsession with omitting parenthesis? Do you 
have something against them? Are you a parenthesis racist? Were you 
sexually abused as a child by parenthesis? :-O
(please take this lightly, it's not meant to be insulting or flaming :o) )

But I'm banging my head here. This issue is just like the omittable 
parenthesis for function calls: you're adding a special case whereas the 
normal syntax works fine, is more consistent (visually and otherwise) 
and likely easier to read. (yes, subjective opinion, but still...)
And just like the omittable parenthesis for function calls, this will 
add ambiguities. Just seeing the discussion springing around resolving 
those ambiguities (like adding precedences and whatnot) makes me cringe. 
Why add complexity if the normal case works fine. (I'm guessing your 
answer is that the normal is not fine - gotta save some more of them' 
characters...) I know economy of syntax is important, but Andrei, you 
seem to be taking it to Scrooge McDuck levels of economy.

Also, let me add another case, if it hasn't been mentioned before:
   Foo!Bar!Baz xpto;
is that Foo!(Bar!(Baz))? or (Foo!(Bar))!(Baz)
Yes, I know that it would be a rare occurence for both such cases to be 
semantically valid, but it's possible.


Andrei Alexandrescu wrote:
 > KennyTM~ wrote:
 >> But how do templates with no arguments be called? Is “T!” valid?
 >
 > Offhand, that looks like it can't work, but haven't we all been wrong
 > before? :o)
 >

Good that it won't work. But the door is still open for this same 
feature with other symbols other than "!", so I'm still worried.


-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list