phobosx.signal ready
Robert
jfanatiker at gmx.at
Mon Jul 15 12:49:55 PDT 2013
phobosx.signal ready
I finished my std.signals2 implementation. I moved it to:
https://github.com/phobos-x/phobosx/blob/master/source/phobosx/signal.d
you can also find it in the dub registry:
http://code.dlang.org/packages/phobosx
Documentation:
https://vhios.dyndns.org/signal.html
I renamed it from std.signals2 to phobosx.signal. When included in
phobos it will most likely be named std.signal.
Improvements over std.signals:
- No more heisenbugs
(http://d.puremagic.com/issues/show_bug.cgi?id=4150)
- safe connect method to an object's method (weak ref semantic)
- support for indirect connect to an object's method via a wrapper
delegate (weak ref semantics to target object)
- strongConnect method for connecting to non objects. (strong ref
semantics)
- disconnect method for disconnecting all methods of a given
object with
a single call.
- Proper exception handling. Meaning if a slot throws an
exception the
other slots will still be called and all slot exceptions are
chained
together.
- signal methods are safe to call from within a slot.
- signal copying is forbidden. While this implementation would not
cause segfaults when copied like std.signals, it is not really
clear
how a signal should be copied in the general case.
- Signals are implemented as structs instead of a mixin and every
template parameter agnostic code also does not depend on the
template
parameters -> avoid template bloat.
- Memory footprint for empty signal is even lower than the one of
the
current std.signals, which is important because many signals
end up not
being used at all.
- Provided string mixin which allows only the containing class to
issue emit(), but everyone to connect.
- Slots are called in the same sequence as they were registered.
I could not find any more bugs, so please use it and show me the
bugs I missed :-)
Have fun!
Best regards,
Robert
More information about the Digitalmars-d-announce
mailing list