State of the Beam survey

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

1 Like

Haha yes I’m aware, that’s why I said ‘again’ :003:

Robert has been a constant (and a regular on this forum) for quite some time now :003:

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. :grin:

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. :slight_smile: 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 :slight_smile:.

8 Likes

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.

9 posts were merged into an existing topic: Discussion about syntax preferences (split posts)

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.)

1 Like

Yup, we have definitely gone off-topic. :smiley:

2 Likes

Ok
 I’ve moved off-topic syntax posts to the Syntax thread as best I could :023:

1 Like