One of the cool features that Reaction had that I believe @aldeed came up with is the way that you could use functionsOfType to define a "pipeline" of functions that, for example, a cart might flow through on placeOrder so any plugin could insert itself into that to apply a discount for example.
I think we should reimplement it but possibly make it more explicit. Some ideas might be:
Create a separate 'pipeline' object separate from functions of type where you could declare a named pipeline and then have methods on that.
Allow functions to insert themselves as more explicit places like "last" or "first"
Allow plugins to remove another entry in the pipeline or replace an existing one
Use decorators to be able to add a pipeline to a method
Allow a function to cleanly abort a pipeline and have the calling method catch the error
One of the cool features that Reaction had that I believe @aldeed came up with is the way that you could use functionsOfType to define a "pipeline" of functions that, for example, a cart might flow through on placeOrder so any plugin could insert itself into that to apply a discount for example.
I think we should reimplement it but possibly make it more explicit. Some ideas might be: