A few things:
 * I don't like the separation between connect/strongConnect

It should be possible to make strongConnect just another overload of connect, but I chose to use another name because of the changed semantics. This way both the writer and the reader of the code have a clue what is going on. If strongConnect was also called connect, you could easily choose a strong connection by accident: sig.connect(&o.watch); // Oops strong connect.

* I would like to bind a strongConnect to a class, if the class is gone
the strongConnect should be gone, too. E.g.
"window.single_key_down[JUMP].strongConnect({ physics.jump(); });" physics is a class variable, this will blow up once the class holding it
is gone

If physics is on the GC collected heap - nothing is going to blow up. The signal just keeps a strong ref to physics so the GC won't free it. If physics is for example reference counted or its lifetime is managed manually then it would blow up if you forget to call disconnect before destroying the object.

It would be easier if you used connect instead of strongConnect, this way the connection is dropped whenever physics gets destroyed, whatever the cause is. Also the signal won't keep it alive.

If you really mean a class by 'class variable' than it can't really be gone, except maybe for dynamic linking. In this case you would have to manage your connections yourself.

* I don't like the connect api for class-method connects, I write all the time "window.on_mouse_pos.connect!"on_mouse_pos"(this);" (the this is kinda annoying), doesn't something like signal.connect!(bla)() work,
with an alias template param?

Unfortunately I don't see how this could work, but I am open for suggestions.

 * Why is there no convenience class for Signal? Since the copy
constructor is disabled, I have to use a pointer, not a big deal, but a
class would be more convenient.

Not sure about this. It would just be a wrapper doing nothing except forwarding function calls, is this really better:

 auto sig = new SignalWrapper!(int)();
 void func(SignalWrapper!int sig) {}

than

 auto sig = new Signal!(int)();
 void func(Signal!int* sig) {}

?

Other than that! Great job, I had not a single segfault so far (only 3
"starts" so far though :>)

:-)

Reply via email to