"for" statement issue
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 21 06:42:49 PDT 2016
On Friday, 21 October 2016 at 13:33:26 UTC, Stefan Koch wrote:
> It does create a lambda?
> Hmm that should not happen.
Eh, that's exactly what the language rules say should happen, and
it actually does make sense to me... you might even want to use
an immediately-called lambda to group several statements together
into one expression.
Though I have become convinced recently that we should deprecate
the `{ lambdas }` in favor of `() { lambdas }`. This is the same
mistake as `() => {xxx}` that we see a bunch of newbies make. If
the syntax was changed to require the empty parens for the args,
`() {}`, people would be a lot less likely to mess this up... and
the rest of us don't seriously lose anything, adding `()` is easy
enough if they aren't already there.
I think deprecating `{ lambda }` is really the way to go. It'd
fix this as well at that other FAQ at pretty low cost.
More information about the Digitalmars-d
mailing list