70 points · by ingve · 2y ago · 39 comments
After mucking around with import paths in so many languages for so long, I like that elixir is like “all the namespaces everywhere”
One thing I've never thought about, but you could potentially just make a single file with all the imports and that would make it easier to check, but it still just feels too much like magic and loss of control.
I’d assume elixir looks at every file in the lib directory and compiles them. They all then get loaded into the beam vm with their respective module names
We wrestled with the same issue in PRQL. There we have "data last" in order to allow for currying and our pipe operator just pipes to the last argument so you still have the same pipeline syntax.
I also like the qualified imports. The lack of those was what turned me off Nim.
Rye has an interesting approach with the * syntax to allow injecting into the second argument for op-words: https://ryelang.org/meet_rye/specifics/opwords/
For anyone that hasn’t tried writing Elixir style code with the pipeline operator should definitely check it out. It’s fun to iterate in the repl too, since you can build it sequentially without adding braces for nesting calls.
It just doesn’t have static types, it has strong types.
That difference gives you the flexibility to avoid circumstances where static typing can be a hindrance.
https://elixir-lang.org/blog/2024/06/12/elixir-v1-17-0-relea...
R.map(arr, (x) => x + 1)
and as part of a pipe in a data-last way: R.pipe(
[0, 1, 2, 3, 4, 5, 6],
R.map((x) => x + 1),
R.filter((x) => x % 2 === 0),
R.take(1)
)
I've really enjoyed using it and would recommend it to anyone who would like to write their typescript in a more functional way.Having the arguments order flipped means that currying and pipeline do not play nicely together.
I don’t see how the Gleam approach is better.