I don't think any discussion that is centered around this topic of being possible to put the closure out of the parens will ever bring anything. Groovy had it for a long time, and it's one of the main things that make it suitable for human readable DSLs. Just compare the readability of builders. If we had to write:
html({ head({ title('Damn ugly' )}) body({ div([class:'main'], { p('foo') }) }) }) instead of what we can do today: html { head { title 'Groovy' } body { div(class: 'main') { p 'foo' } } } No doubt I would never have chosen Groovy to build DSLs. 2015-12-02 1:14 GMT+01:00 alessio <aless...@gmail.com>: > > > > yes > > Thanks. > > > > > the problem simply is that while(x, {doSomething()}) looks quite ugly ;) > > It absolutely does, agreed (but then all these inlined functions do in > most languages :) ). > Nonetheless, while visually maybe not appealing, I'd argue it makes > semantically more sense to have it in that place than "suddenly" > outside of the function call. > > And yes, I understood that the regular way is still possible, my > "complaint" was rather about this additional alternative, which really > left me staring at the screen for a good while today (possibly > similarly as when I discovered Angular's insanity of using the > argument names for dependency injection - different subject though). > > Anyhow, thanks for having taken the time to explain the details. > > > > > if ultimate means last argument, then yes ;) > > It does :) > Thanks for the clarification. > > So, just for yet another better understanding, whenever there is a > code block (-> closure) after a function call, it automatically gets > appended as additional argument? >