Regarding Issue 9423
Timon Gehr
timon.gehr at gmx.ch
Wed Jan 30 10:17:04 PST 2013
On 01/30/2013 12:10 PM, bearophile wrote:
> Currently you are allowed to write a lambda literal as in line 3, but
> you can't omit "ref" as in line 4:
>
>
> void foo(int delegate(ref int[1]) spam) {}
> void main() {
> foo((ref x) => 0); // line3, OK
> foo(x => 0); // line4, Error
> }
>
>
> Do you think "ref" annotation should be required at the call site?
>
> This is the Bugzilla thread. Hara has already implemented the "ref"
> inference, but he's not sure if it's a good idea:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=9423
>
> Bye,
> bearophile
I think the current behaviour is ok, but I do not really care.
BTW, the pull does not contain a test for the case
void foo(int delegate(int) dg){ ... } // 1
void foo(int delegate(ref int) dg){ ... } // 2
void main(){ foo(x=>0); } // call 1
More information about the Digitalmars-d
mailing list