Thread overview |
---|
December 28, 2017 DLang Tour : Functions as arguments | ||||
---|---|---|---|---|
| ||||
On this page: https://tour.dlang.org/tour/en/basics/delegates there is: -------------------------------------------------------- void doSomething(int function(int, int) doer) { // call passed function doer(5,5); } doSomething(add); // use global function `add` here // add must have 2 int parameters -------------------------------------------------------- I can't get it to compile unless it is: doSomething(&add); |
December 28, 2017 Re: DLang Tour : Functions as arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tony | On Thursday, 28 December 2017 at 01:37:16 UTC, Tony wrote: > On this page: > https://tour.dlang.org/tour/en/basics/delegates > > there is: > -------------------------------------------------------- > void doSomething(int function(int, int) doer) { > // call passed function > doer(5,5); > } > > doSomething(add); // use global function `add` here > // add must have 2 int parameters > > -------------------------------------------------------- > > I can't get it to compile unless it is: > > doSomething(&add); Thanks for reporting this. This will be corrected soon: https://github.com/dlang-tour/english/pull/220 If you find more issues, please rather use this bug dedicated tracker https://github.com/dlang-tour/english/issues. |
December 28, 2017 Re: DLang Tour : Functions as arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Thursday, 28 December 2017 at 10:20:59 UTC, Basile B. wrote:
> On Thursday, 28 December 2017 at 01:37:16 UTC, Tony wrote:
>> On this page:
>> https://tour.dlang.org/tour/en/basics/delegates
>>
>> there is:
>> --------------------------------------------------------
>> void doSomething(int function(int, int) doer) {
>> // call passed function
>> doer(5,5);
>> }
>>
>> doSomething(add); // use global function `add` here
>> // add must have 2 int parameters
>>
>> --------------------------------------------------------
>>
>> I can't get it to compile unless it is:
>>
>> doSomething(&add);
>
> Thanks for reporting this. This will be corrected soon:
>
> https://github.com/dlang-tour/english/pull/220
>
> If you find more issues, please rather use this bug dedicated tracker
>
> https://github.com/dlang-tour/english/issues.
Or simply click on the edit button yourself. Thanks for reporting and thanks @Basile for fixing it!
|
Copyright © 1999-2021 by the D Language Foundation