https://issues.dlang.org/show_bug.cgi?id=3720
--- Comment #14 from Steven Schveighoffer <[email protected]> --- (In reply to Mike Franklin from comment #13) > > My preference would be to embed in the type of the function pointer, the > > fact that it takes a hidden context pointer. Then the compiler can disallow > > simply calling it without stuffing it into a delegate. > > Is that different from (2) in comment 11? Yes, I would want to introduce a new piece of the type system, e.g.: void function(this) which means "I can only be called when in a delegate". At the moment, we can't type the context pointer, since it's void *, and the types will have problems if you are playing fast and loose with the delegate internals (there is definitely code out there that plays with delegate function pointers). Perhaps there is room here to have loose type requirements, but I don't know how that might break existing code. Worth exploring, though. --
