Nicer syntax for calling free functions in a chain. Useful to avoid nested calls. Accepts local free functions, proc objects and blocks.
fn(value) -> value + 1
puts 1 |> fn |> fn |> fn # outputs 4. Equivalent to fn(fn(fn(1))), and much nicer
Might be redundant if UFCS is implemented. Then again, maybe this is preferable to UFCS. After all, a free function isn't a method, so it might be a good idea to differentiate in this manner. Alternatively, implement both. The |> operator would have a lower precedence than ., so perhaps each one has its merit.
Nicer syntax for calling free functions in a chain. Useful to avoid nested calls. Accepts local free functions, proc objects and blocks.
Might be redundant if UFCS is implemented. Then again, maybe this is preferable to UFCS. After all, a free function isn't a method, so it might be a good idea to differentiate in this manner. Alternatively, implement both. The
|>
operator would have a lower precedence than.
, so perhaps each one has its merit.