middleware
middleware copied to clipboard
Immutable Stacks or ability to easily copy a stack
I have a project where I would like to setup a reference stack and then make a few different stacks that differ in only a small way from the reference stack. For instance:
stack = Middleware::Builder.new do
use Trace, "A"
use Trace, "B"
end
stack2 = stack.dup
stack2.insert_after(2, Trace, "C")
stack2.call
--> A
--> B
--> C
<-- C
<-- B
<-- A
But currently ater I run the above code and I call stack.run, it gives me the same output that stack2 gave me.
If I open a pull request to fix this would you be open to supporting this feature?