Hacker News new | past | comments | ask | show | jobs | submit login

> In typescript, you can have abstract classes or interfaces to implement

In erlang these are called "behaviours"

.

> I was relying on documentation for that

Consider reading the Erlang documentation. The Elixir people really don't understand Erlang very well, and are trying to manufacture Ruby on top of a language that already gives them solutions to their problems that they just can't see.

.

> If there was a way to say use @some_spec and get information about it in the editor. It would have helped out.

Basically every IDE that speaks Erlang knows behaviors. They're as fundamental to the language as header files are to C/C++.

Elixir tried to "do away with them" because Elixir thinks they're "confusing" but they're actually really important tools.




> Elixir tried to "do away with them" because Elixir thinks they're "confusing" but they're actually really important tools.

That's completely inaccurate. They are an important part of Elixir and they are fully documented.

Elixir even has annotations that allow you to say "this function maps to a behaviour's callback". For example:

    @behaviour GenServer

    @impl true
    def handle_info(msg, state)
Those are important because, with optional callbacks, you can make a typo on the function name or on the number of arguments and you won't get any warning, in both Erlang and Elixir. "@impl true" allows you to close this gap.

So we do support behaviours and we have added more static guarantees compared to what you would find in Erlang.

> The Elixir people really don't understand Erlang very well

It is a bit depressing it has come to this but my long list of contributions to Erlang/OTP through pull requests, discussions, EEPs, etc say otherwise.


I wouldn't feed the troll. The many people who know and appreciate your language realise how much of an improvement Elixir represents over Erlang.

Including Joe Armstrong himself... https://joearms.github.io/published/2013-05-31-a-week-with-e... ^_^


Elixir hasn’t done away with behaviours. They exist in the language and are used to implement features in the standard library itself and many libraries in the ecosystem.

You don’t have to go to Erlang documentation to learn about them since they are documented in Elixir as well [1] [2].

[1] https://elixir-lang.org/getting-started/typespecs-and-behavi... [2] https://elixir-lang.org/getting-started/typespecs-and-behavi...


Elixir does not try to do away with them. They are covered in the official guide: https://elixir-lang.org/getting-started/typespecs-and-behavi...

As soon as I add @behaviour to a module, I get IDE autocomplete and compiler warnings if a function has not been implemented.

I do agree that I have not seen a lot of behaviour use in the wild, even in cases where it's clear that they would be beneficial. Elixir developers seem to have some blindspots.


> As soon as I add @behaviour to a module, I get IDE autocomplete and compiler warnings if a function has not been implemented.

It is exactly what I was looking for. Thanks for mentioning it.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: