dry-rb / dry-effects

Algebraic effects in Ruby
https://dry-rb.org/gems/dry-effects/
MIT License
112 stars 20 forks source link

Pass current stack to as block argument instead of running it in place #47

Closed flash-gordon closed 5 years ago

flash-gordon commented 5 years ago

This gives more control over the stack and works better in practice. One should keep in mind that fork only copies stack values but does not re-instantiate stack calls for a bunch of reasons. 1. It's not possible in general (though we can always write providers in a compatible manner). 2. It's usually not needed, accessing these values is enough.

I think in future we'll have an (optional) warning or something like that for cases where stack cannot be safely copied. It depends on how often people need this in real life.