Robert Penner wrote these 3 blog posts which summarise the limitations:
He's been working on an alternative known as as3-signals, which you'll find on git-hub.
Essentially signals seem to provide the following enhancements: (correct me if I'm wrong here)
- A type based rather than string based registration for an event.
- Compile time checking that you only register for relevant signals. If SomeClass doesn't have a .clicked signal then you won't be able to listen for it.
- Centralised and handy functions for removing all listeners from an event.
- The ability to add a listener for one time only (and have it automatically removed).
- Useful runtime errors (if you use 'addOnce' after you've already used 'add' or the reverse you get a sensible error).
- The option to prioritise listeners - enforcing a calling order.
I'm currently working on this modularised rebuild of an existing piece of complex software. Inter-module communication is the thing I'm thinking about most.
I've also been checking out the interesting stuff over at robotlegs - a DI driven framework which looks light and really focussed... except that Flash CS4 won't let you use the metadata required, so it seems to be Flex only for now.
However, it has a nice command and event mapping model - allowing for type checking, 'one shot only' and so on.
So... I'm considering the benefits of a hybrid. Of creating a command mapped version of as3-signals.
1) How to replicate the nice compile time checking that Signals provides while also supporting the decoupling of the modules via the centralised command map - so you can't register for an event that will never exist.
2) Where to put the events? Which package? Do they need to reside in a centralised area?
3) Is this a complete waste of time? Does the command map already provide sufficient decoupling? Should I simply use signals within a module and the command map between modules?
4) Could a module create a new signal 'channel' dynamically, or does that make no sense at all?