On Saturday, 15 March 2014 at 09:41:18 UTC, Steve Teale wrote:
On Saturday, 15 March 2014 at 09:13:47 UTC, Rikki Cattermole
wrote:
yours no.
Because a delegate stores a context ptr aka this. As well as a
function pointer. What you were doing meant that no content
pointer was being stored. Essentially it was just a function
pointer without the first argument added.
Why isn't the first argument, removed in the rewrite, used as
the context?
In cases where the type of the first argument was not suitable,
the compiler could issue an error message.
Because it must be explicit in nature when its created. You can
have many delegates to the "same" method on a class/struct but
they are different if the instances are not the same.