Skip to content

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 than event 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.