Re: How to understand context type of a delegate?

2018-09-08 Thread Jacob Shtokolov via Digitalmars-d-learn
On Wednesday, 5 September 2018 at 16:53:42 UTC, NX wrote: Is there a way to know what kind of context a delegate has either in compile time or runtime? Also is there any way to check whether a pointer legitimately points to an Object instance? No and no. I was fighting this problem in

Re: How to understand context type of a delegate?

2018-09-06 Thread Kagamin via Digitalmars-d-learn
Maybe poke into GC and see if it has ClassInfo associated with the allocated block.

How to understand context type of a delegate?

2018-09-05 Thread NX via Digitalmars-d-learn
I was sketching some simple event-listener code and looked up std.signals module for some inspiration. Documentation says that it only works if the delegate used for slots are a class/interface member function. Digging into the code it seems like it's because _d_toObject(void*) function is