Actions
Feature #13600
closedyield_self should be chainable/composable
Feature #13600:
yield_self should be chainable/composable
Status:
Rejected
Assignee:
-
Target version:
-
Description
One of the main use cases that would make yield_self a helpful addition is to build functional pipelines (function composition). This is currently not possible since Proc/Lambda do not handle yield_self in the expected way.
I believe that callable.yield_self(&other) should build up a composition, something like this:
I originally proposed an example for this using pipe | syntax here:
https://bugs.ruby-lang.org/issues/10095#note-22
Maybe Proc should use | or & for this syntax instead of changing yield_self directly.
Updated by avit (Andrew Vit) about 9 years ago
Updated by shyouhei (Shyouhei Urabe) about 9 years ago
- Related to Feature #6284: Add composition for procs added
Updated by shyouhei (Shyouhei Urabe) about 9 years ago
I'm not sure if this should be an extension to yield_self or a separate new method.
Updated by matz (Yukihiro Matsumoto) almost 9 years ago
- Status changed from Open to Rejected
Function composition should not be implemented by yield_self.
Matz.
Actions