Towards a "functional" approach
A more functional approach would be helpful in removing state and making it easier to pipeline and optimise the stage sequence.
There are a few changes to the existing code that would help move us in that direction:
- stages'
event
method should become__call__
: if the method that actually manipulates the data were just__call__
rather thanevent
existing stages would behave like functors, indistinguishably to a direct function call. - Replace the
__init__
method of a stage with a factory function which returns a configured function / immutable functor. Keeping this pickleable will be important for current alphatwirl, although perhaps this restraint might be relaxed in the future too. - The config file should allow stages to be defined without any additional configuration.