On Thursday, 16 July 2015 at 09:57:55 UTC, Jarl André Hübenthal wrote:
On Thursday, 16 July 2015 at 09:52:59 UTC, ponce wrote:
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André Hübenthal wrote:
Why?

The syntax for delegate literals with braces is

listenHTTP(settings, (req, res) {
        res.writeBody("Hello, World!");
});

Thanks. Those small details you forget to test before asking is a bit embarrassing. I blame Scala for it :) In Scala its (req,res) => { ... } consistently.

The difference in D is that (req, res) => { ... } is still valid syntax, but it doesn't do what you'd expect. { /* some code */ } is a valid delegate literal in D, specifying a delegate literal that takes no arguments. Thus, (req, res) => { /* some code */ } actually creates a delegate literal than returns *another* delegate literal.

Reply via email to