On 8 June 2013 12:29, Michel Fortin <[email protected]> wrote:
> On 2013-06-07 23:57:40 +0000, Manu <[email protected]> said: > > Precisely. The concept is already embedded inside of delegate, but >> delegate >> is framed like a piece of magic, rather than a well defined compound of >> more primitive pieces. >> > > Delegates are not parametrized on the type of "this", which makes them > easier to move around. I would not change delegates. > Actually, that's very true. Good point, and I think this is almost the key distinction. But function pointers with a "this" parameter would be useful. You can > achieve this using a template struct containing a pointer and a call > method: the call method would generate a local delegate variable from the > pointer and and call it. What you can't do without compiler support is get > such a pointer in a type-safe manner. Yup, this is what I originally did. It's big and ugly, I didn't like it, and deleted it. I think the syntax I suggest is simple and obvious, and naturally, typesafe.
