On Friday, 21 January 2022 at 12:55:58 UTC, ag0aep6g wrote:
On 21.01.22 13:33, Mike Parker wrote:
### Mathias
Mathias would very much like to see the unification of delegates and function pointers. There was general agreement that this is a good goal to aim for. Mathias subsequently informed me he will look into it once some other things are off his TODO list if no one else gets to it first.

I still believe it should be fairly simple:

https://forum.dlang.org/post/ofc0lj$2u4h$1...@digitalmars.com

Actually, the idea I had in mind is a little different.
Because a delegate is essentially:
```D
T function (T, Args..)(void* ctx, Args args)
```

It should be possible for the compiler to generate a call to a trampoline function that just forwards to the actual function:
```D
RT _d_trampoline (FT, RT, Args..)(void* ctx, Args args)
{
    return (cast(FT) ctx)(args);
}
```

Reply via email to