On 2010-12-19 16:23, Andrei Alexandrescu wrote:
On 12/19/10 6:26 AM, retard wrote:Sat, 18 Dec 2010 16:01:37 -0800, Walter Bright wrote:Simen kjaeraas wrote:The problem of D's lambda syntax is it is optimized for longer functions. Usually, the delegates I write are one line long. I cannot see that this syntax collides with anything at the moment, but feel free to enlighten me: { => 4; } { a => 2*a; } { a, b => a>b; } { => @ + @; } // turns into { a, b => a + b; }If size and simplicity of typing are critical, are those really better than: "a>b"In case you didn't see, two additional problems were also listed earlier in this thread: - template bloat (different strings generate new instances of the sort in the sorting example)This can be solved by using a canonicalizer before passing to unaryFun. I considered doing that, but delayed implementing it to when this would actually become a problem.
I can clearly see that you haven't used an Objective-C/D bridge. The reason (or at least one of the reasons) for which Michel Fortin (as well as I) gave up the Objective-C/D bridge and started to modify DMD is template bloat. I'm not saying that using template strings as lambdas is going to bloat your executable/library as much as the bridge does but I always think twice before adding a template to my code.
- symbol visibility problems because of wrong scopingScoping is not wrong, it's just different :o). I agree that that can be an issue - in which case you take the enormous hit of writing (a, b) { stmts }, of which the proposals passionately discussed within save a grand total of around four characters.
I don't know why but you added the {} characters.
Again: to what extent does this help on becoming able to do what you want to do in D, and where is implementing this ranked in comparison to the other work items? Andrei
-- /Jacob Carlborg
