4 ms·
Interesting perspective! I definitely didn't know about |> def I suppose ruby has dynamic def as well though.
by adenozine 6y ago
Interesting perspective!
I definitely didn't know about |> def
I suppose ruby has dynamic def as well though.
- tel 6y agoI don't think it's dynamic, just macros. a |> foo() |> def do ... end just gets macroexpanded to foo(a) |> def do ... end and then def foo(a) do ... end.
- dnautics 6y agoI didn't know about |> def, but at the same time I'm totally not surprised (you should never use it though). |> case do is a fun one that I actually do use often.
- rkangel 6y agoI've almost written "|> case do" several times and then in each case have decided that it makes sense to a separate private function (with function head matching for the different cases).
- mercer 6y agoI've found "|> case do" to feel 'right' at times when it's at the end of the pipeline.