std.signals non-object delegates
Jacob Shtokolov
jacob.100205 at gmail.com
Thu Jun 7 12:56:55 UTC 2018
Hello,
I'd like to start a discussion about the standard std.signals
library.
Currently it has a strange limitation - you can't pass delegates
that don't belong to an object.
I reviewed the source code an came to conclusion that it can be
easily fixed.
However, the thing that concerns me more is how to deal with
delegates whose allocated frame pointer (context) was disposed by
GC.
In the case of object's delegate, the library places dispose
handlers via the `rt_attachDisposeEvent`, so if GC just freed an
object, all related callbacks will be unregistered automatically.
But I'm not really sure how to do the same for a bare frame
pointer.
I'd like to attract some attention to this topic, because I see
that people tend to re-implement the same functionality over and
over again in their projects.
For example, look at the DLangUI by Vadim Lopatin:
https://github.com/buggins/dlangui/blob/master/src/dlangui/core/signals.d - the same functionality, but without this stupid limitation (in terms of user experience).
Any suggestions?
More information about the Digitalmars-d
mailing list