AlexandreDecan / sismic

Sismic Interactive Statechart Model Interpreter and Checker http://sismic.readthedocs.io/
GNU Lesser General Public License v3.0
141 stars 25 forks source link

Signal-based hooks #74

Closed AlexandreDecan closed 6 years ago

AlexandreDecan commented 6 years ago

(Discussion introduced in #72)

Another thing that I would like to change is the way we defined hooks and "notifications". Basically, in the current implementation, we have many direct hooks (like the many methods of PythonEvaluator that are called by the interpreter at specific points), "indirect hooks" (like the meta-events to support property statecharts) and "observable objects" (like the clock, the event queue, the trace, etc.). I would like to have a more uniform approach to deal with all these "hooks", and I'm currently looking into a signal-based communication between components (e.g. the interpreter defines signals like before execute, before step, after execute*, on state entered, on consumed event, etc., and other components can subscribe to those signals and attach callbacks to them). This will greatly simplify many parts of the current implementation, but will also contain a lot of breaking changes, e.g.:

Given the breaking nature of these changes, I'll reserve them for Sismic 2.0.0

AlexandreDecan commented 6 years ago

We will probably implement a more general hooking-system.