Re:Pipelining might be my favorite programming language feature
by Terr_ on Monday April 21, 2025 @02:15PM
(#43754809)
IIRC the usual workaround in Elixir involves be small lambda that rearranges things:
I imagine a shorter syntax could someday be possible, where some special placeholder expression could be used, ex:
However that creates a new problem: If the implicit-first-argument form is still permitted (foo() instead of foo(&1)) then it becomes confusing which function-arity is being called. A human could easily fail to notice the absence or presence of the special placeholder on some lines, and invoke the wrong thing.
[ Parent
| on HN ]
Re:Pipelining might be my favorite programming language feature
by hinkley on Monday April 21, 2025 @03:49PM
(#43755730)
Yeah I really hate that syntax and I can’t even explain why so I kind of blot it out, but you’re right.
My dislike does improve my test coverage though, since I tend to pop out a real method instead.
Re:Pipelining might be my favorite programming language feature
by freehorse on Monday April 21, 2025 @07:07PM
(#43757492)
Yeah, R (tidyverse) has `.` as such a placeholder. It is useful but indeed I find the syntax off, though I find the syntax off even without it, anyway. I would rather define pipes as compositions of functions, which are pretty unambiguous in terms of what arguments they get, and then apply these to whatever i want.