Problem with trying sample from doc page

2014-07-16 Thread Pavel via Digitalmars-d-learn
Hi! I've been experimenting with D functions, and found this piece of code: // int abc(int delegate(long i)); int def(int function(long s)); void test() { int b = 3; abc( (long c) { return 6 + b; } ); // inferred to delegate def( (long c) { return c * 2; } ); // inferred to function }

Re: Problem with trying sample from doc page

2014-07-16 Thread Pavel via Digitalmars-d-learn
On Wednesday, 16 July 2014 at 15:12:58 UTC, Pavel wrote: Hi! I've been experimenting with D functions, and found this piece of code: // int abc(int delegate(long i)); int def(int function(long s)); void test() { int b = 3; abc( (long c) { return 6 + b; } ); // inferred to delegate def(

Re: Problem with trying sample from doc page

2014-07-16 Thread Adam D. Ruppe via Digitalmars-d-learn
I would just change all the longs to ints and it would probably work. Or all the longs to ints. It really should have been consistent in the docs, since the point of this is delegate vs function, not int vs long...

Re: Problem with trying sample from doc page

2014-07-16 Thread Brad Anderson via Digitalmars-d-learn
On Wednesday, 16 July 2014 at 15:44:03 UTC, Adam D. Ruppe wrote: I would just change all the longs to ints and it would probably work. Or all the longs to ints. It really should have been consistent in the docs, since the point of this is delegate vs function, not int vs long...