From: fg@... Date: 2018-12-31T11:28:48+00:00 Subject: [ruby-core:90836] [Ruby trunk Feature#10548] remove callcc (Callcc is now going obsoleted. Please use Fiber.) Issue #10548 has been updated by decuplet (Nikita Shilnikov). FWIW, I do have a practical example for `callcc` which cannot be implemented with fibers, or at least I don't see the way it could. I'm the author of the [dry-monads](https://github.com/dry-rb/dry-monads/) gem. Along with a bunch of monads it provides an emulation of Haskell's do notation: ```ruby class Operation include Dry::Monads::Result::Mixin include Dry::Monads::Do def call(monadic_value) extracted_value = yield monadic_value # ... Success(extracted_value + 1) end end ``` Here if `monadic_value` is `Success(value)` then `yield` will extract `value` from it and continue the execution. And if `monadic_value` is `Failure(...)` it will halt the execution and return this `Failure` as a result of `call`. Everything works perfectly fine and allows writing robust production code but only for monads that wrap 1 value inside. That is, it doesn't work for the list monad: ```ruby class Operation include Dry::Monads::Do include Dry::Monads::List::Mixin def call v = yield List[1, 2, 3] List[v + 1] end end ``` ^this will return `List[2]` rather than `List[2, 3, 4]`. In order to make it work as expected, I would need to capture the continuation within `yield` so it can continue `call` more than once. I tested it, and it indeed works, but I don't want to depend on a to-be-removed feature. ---------------------------------------- Feature #10548: remove callcc (Callcc is now going obsoleted. Please use Fiber.) https://bugs.ruby-lang.org/issues/10548#change-76019 * Author: tarui (Masaya Tarui) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- We are paying a lot of costs for callcc's consistency. and currently, we can use Fiber in many situation. In https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20140517Japan, matz agreed to remove callcc. If there is no refutation, remove callcc in the future version. -- https://bugs.ruby-lang.org/ Unsubscribe: