std.signals non-object delegates

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 12 14:33:57 UTC 2018


On 6/12/18 9:04 AM, Jacob Shtokolov wrote:
> On Thursday, 7 June 2018 at 12:56:55 UTC, Jacob Shtokolov wrote:
>> Hello,
>>
>> I'd like to start a discussion about the standard std.signals library.
>>
>> [...]
> 
> 5 days passed and no one answered 😒

I'll respond to say that I don't know a lot of people who use signals 
and slots. It's a very old part of Phobos, and I think a lot of people 
here aren't familiar with it.

> 
> Maybe the guys who are contributing to DRuntime could answer: is that 
> possible to attach GC dispose event handlers to the delegate context?

I've never heard of this functionality. Looking it up, it's not used 
anywhere in druntime, only from phobos, and only from this std.signals 
implementation (literally a search through all code finds the function 
rt_attachDisposeEvent in 2 places -- the definition, and the one usage 
in std.signals).

Looking at the implementation, it depends on having an Object with a 
Monitor, as the event is stored in the monitor. So you couldn't attach 
it to any specific piece of memory, it HAS to be an Object.

But like I said, it's not used pretty much anywhere. So I think nobody 
would miss it if you ripped it out and made it better :)

feel free to open a bug report and/or PR and get some more discussion going.

-Steve


More information about the Digitalmars-d mailing list