Just to explain the context - Fred Hebert used the underscore in his fancyflow experimental Erlang pipe library.
Joe Armstrong critiqued Elixir back in 2013: A week with Elixir
Just to explain the context - Fred Hebert used the underscore in his fancyflow experimental Erlang pipe library.
Joe Armstrong critiqued Elixir back in 2013: A week with Elixir
Haha yes Iâm aware, thatâs why I said âagainâ
Robert has been a constant (and a regular on this forum) for quite some time now
I agree with you. There are places that I prefer the Erlang syntax too, such as function headers. On the other hand, do-end blocks consistently power a lot of Elixir macros and they play an important part behind Elixirâs extensibility. So yeah, you win in some places, but lose in others.
Note: I dislike the comprehensions syntax in Erlang and other functional languages because variables are declared after they are used and often times they are the only construct in such languages with this property. The mathematical resemblance is foreign to most. I am sure many disagree though.
I would also like to add that the reason integrating with Erlang packages is straightforward is because we put a lot of work into supporting both rebar2 and rebar3 directly from mix.
At the very beginning, my plan was not create mix at all, but instead extend and improve rebar2. Nobody was interested in such changes which is when we decided to roll our own. I am glad things seem to be changing and we have been able to contribute more directly lately, with projects such as Hex and to OTP itself.
In any case, if there is an interest from the Erlang community in using Elixir packages, I believe it is up to them to close the gap. If there is anything lacking from the Elixir side to make this integration possible, we will be glad to discuss it.
The same applies with things like records and structs. Elixir has a whole Record module which exists almost exclusively for integration with Erlang. If someone wants to use structs from Erlang, then I expect a similar amount of work is necessary. The main issue is macros but the whole reason we have macros is to write some constructs that wouldnât be possible otherwise.
Given the whole language was designed with interoperability in mind, no, we didnât add a feature on purpose to prevent such interoperability. If you count the modules in Erlang stdlib+kernel, you will notice most of them receive the subject as first argument.
About the functions in the Elixir libs, hindsight is 20/20. We only know those features are useful because we have added and battle-tested them. It is much easier to argue their worth now. Luckily there is nothing stopping you (and the community) from contributing those back. I am doing my part .
I kinda like _
. It reminds me of one of those âfill the gapsâ questions in tests. It says âfill me with somethingâ. But this is extremely subjective, of course.
For lnguages that donât support automatic currying, having the subject as a first argument âfeelsâ more natural.
It might feel less natural if you like to read code as if it were English: you append an element to a list, not a list to an element, but unless the code isnuseing a particularly good DSL to map the domain in a very concrete way, I donât usually read code as prose.
If the language supports currying, it should go to the end. The fact that Elixirâs pipe operator is a macro is pretty cool, because it allows us to have the more intuitive âsubject as a first argumentâ and piping that works as well as hakellâs. The awkwardness of piping is 100% related to the awckwardness of anonymous function use and not to piping itself.
This threadâs been flagged as having gone off topic⊠so just a quick reminder to say we have an Elixir syntax thread here: https://elixirforum.com/t/discussion-about-syntax-preferences-split-posts/3436
(If the syntax related posts are regarding Elixir-Erlang interoperability they may be posted in this thread, but otherwise please use the other thread (unless José specifically asks otherwise), thanks.)
Yup, we have definitely gone off-topic.