LDC 1.18.0-beta1
jmh530
john.michael.hall at gmail.com
Tue Sep 24 14:27:51 UTC 2019
On Monday, 23 September 2019 at 20:57:49 UTC, Ivan Butygin wrote:
> [snip]
>
> With @dynamicCompileEmit normal calls to function will go to
> static version but these functions can still be targets for
> bind.
The confusing thing is that if I add a normal call to foo and
then change @dynamicCompileEmit to @dynamicCompile, then it still
works without problem
https://run.dlang.io/is/XZVs0k
>
> Objects returned from bind are reference counted. You can get
> delegate from them to use is context where delegate is expected
> but you need to retain object somewhere. Delegate version will
> add additional call indirection I think but otherwise they are
> identical.
The delegate version adds extra indirection relative to the bind
version, correct? Does the bind version also have an extra
indirection relative to the normal function call?
I suppose what I'm trying to find out is if
auto f = bind(&foo, 30, 10, placeholder);
should have the same run-time performance as
int f(int c)
{
return 40 + c;
}
>
> Also, something got broken with bools, I need to check :)
> https://run.dlang.io/is/x3orGK
Thanks, now that I got it working, I confirmed that if you take
an alias of the result of bind with the same name as the original
function, then it will be called before the normal function.
https://run.dlang.io/is/Tv88PS
More information about the Digitalmars-d-announce
mailing list