auto ref is on the docket
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 22 08:39:44 PDT 2015
On 6/22/15 3:04 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>"
wrote:
> Just lower it to:
>
> {
> auto tmp = 5;
> fun(tmp);
> }
You need to lower an expression to an expression, not a statement. (e.g.
what if fun returns a result?)
I considered this lowering for "int fun(ref int);"
fun(42)
==>>
(function int(int a) { return fun(a); })(42)
This does work, but if fun returns a ref int, I found no way to
syntactically express that lambda. This does not parse:
(function ref int(int a) { return fun(a); })(42)
Is this a bug in the grammar?
Andrei
More information about the Digitalmars-d
mailing list