Last - but not least! - two DConf talks
Jacob Carlborg via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Jul 17 04:28:51 PDT 2015
On 2015-07-17 10:16, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>"
wrote:
> Does your implementation support parameterized lambdas? I can already
> see the next ambiguity:
>
> someRange.each (element) {
> writeln(element);
> }
>
> Do the parentheses belong to the lambda on the right or the function on
> the left?
Currently, in the above example, "element" is interpreted as an argument
to "each".
No, the current implementation does not support parameters. It's a
really simple modification in the parser. If we really want to support
this feature more work could be put in to this and make it work.
I would say that it should first try to interpret "element" as an
argument to "each", if that doesn't work, try as a parameter for the
delegate. Just going with the longest match, if that doesn't work try
the next thing.
This feature has come up before, one of the suggestions back then was to
do allow this syntax:
someRange.each(start; element) {
writeln(element);
}
Everything after the semicolon would be interperted as parameters for
the delegate.
--
/Jacob Carlborg
More information about the Digitalmars-d-announce
mailing list