19 Jun 2012 14:22
Re: Remove the "{}" if the method body is a closure?
Yes, it would not be ambiguous. I like the your suggestion. Is there already an enhancement request in the bugzilla?
Regards,
Sebastian
On 19.06.2012, at 14:19, Freewind wrote:
There is a "def static" in the start, I think the compiler can be smart enough to find out it's a method declaration
On Tuesday, June 19, 2012 8:01:58 PM UTC+8, digulla wrote:Am Dienstag, 19. Juni 2012 09:21:08 UTC+2 schrieb Freewind:This is my current code:def static Handler<HttpServerRequest> update() { [ req |println("TODO")]}You see the method body is just a closure, but we have to wrap it with "{" and "}".Can we remove it in such a case?No, because the method body isn't the closure; it's actually "{ return closure; }"If you omitted the "{}", then you'd create an ambiguity whether you want to return the closure or create update() with the closure as body or call update() with the closure as argument.Regards,A. Digulla
RSS Feed