Hacker News new | past | comments | ask | show | jobs | submit login

Seems to compile fine here, what's the issue?

Edit: I was looking at the wrong snippet, the offending snippet has been fixed.




Probably not used to seeing lambdas inside of parens:

  .get("/", ctx -> ctx.result("Hello World"))
Could also be written as

  .get("/") { ctx -> ctx.result("Hello World") }
The second form seems much more common in Kotlin.


Yeah, no, he was 100% correct, I was just looking at the wrong snippet. It's been fixed now :)


Huh, I wonder what's different with my setup. I would need to put curly braces around that closure before it would compile, i.e:

    .get("/", { ctx -> ctx.result("Hello World") })
Closures defined only by the arrow are a Java thing... or so I thought. :D


> Closures defined only by the arrow are a Java thing... or so I thought. :D

In fairness, I think you did copy the Java version. There's a little switch in the code boxes where you can toggle the language, if you switch to Kotlin you get the version with trailing closures :)

Edit: I'm an idiot, I see the snippet you mean now. It's been updated now, give it a minute.


Sweet, thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: