Open ProjectMoon opened 14 years ago
Possible idea: Objects can subscribe to events about themselves or objects contained within themselves via the standard add*Listener method pattern. Each object that will respond to events will have a corresponding listener interface with specialized methods dealing with events relevant to that object. An object would not be able to subscribe to events about another object.
The question is: Where does this leave things like the Senses API?
Re: Senses API--
Keep Senses API separate, as its own "event handling framework," much like how ticker listening is its own "event handling framework." These object events will fall under their own API category called something like "Reflective Event API" or something else fancy-sounding.
New event API is almost done. Have created Object Index System, and the ability to add events to loaded objects. Have not added the ability for "live" events yet. Also need to integrate Java's observer API to allow objects to subscribe to other objects' events.
Jython has the ability to turn Java event handling into Pythonic event-handling constructs. If you have an event-handling interface that extends EventListener, and then provide an addListener method to a given object, Jython will automagically convert the event listener's methods to properties of the object that take a Python function as a parameter.
This technology should be leveraged for the event-handling framework if at all possible. It is more intuitive than the "query language" idea that is currently kicking around in the RingMUD code.