D’s delegates — The good, the bad, and the ugly

Paul Backus snarwin at gmail.com
Sat Jun 17 18:37:48 UTC 2023


On Friday, 16 June 2023 at 15:29:47 UTC, Quirin Schroll wrote:
> D’s delegates have a few issues, some are outright bugs and 
> others are improvements that I wonder why they’re not in the 
> language.

Excellent writeup. It's nice to have all of these in one place.

> Another conversion that should Just Work is function pointer to 
> delegate, in fact, because a function pointer has no context, 
> its context is `immutable`:

I believe the reason this one doesn't work is that functions and 
delegates have different calling conventions. In order to allow a 
function pointer to convert to a delegate, the compiler would 
have to generate a trampoline.


More information about the Digitalmars-d mailing list