On Monday, 24 April 2017 at 15:47:14 UTC, Jonathan Marler wrote:
On Sunday, 23 April 2017 at 17:13:31 UTC, Basile B. wrote:
[...]

I've added a DIP for this (https://github.com/dlang/DIPs/pull/61).

At first I first thought that all we needed was to add semantics to take the address of a UFCS-style call, but after messing around with your example I realized that delegates are not ABI-compatible with functions that take the delegate ptr as the first parameter. You mentioned that the problem was with the parameter order and that this should work with extern(C) functions and I think you're right.

The new DIP proposes the addition of "Extension Methods" which are functions that are ABI-compatible with delegates. You define an extension method by naming the first parameter "this":
[...]

Scratch the "Extension Methods" idea. I've found a more generalized way to do the same thing. I'm calling it "Delegateable Functions" (https://github.com/dlang/DIPs/pull/61).

Reply via email to