News for hackers. Stuff that matters.
Re:Elixir Is Erlang, not Ruby by vendiddy on Monday September 07, 2020 @07:13AM (#24398568)
Do you have some examples of abstractions that you found to be leaky?

In my first 6 months of Elixir development, I got very far with just modules, structs, and functional programming.

A common pitfall for new Elixir developers is to reach features that are overkill.

Metaprogramming, gen servers, protocols, etc, are powerful, but you don't need to know them to start building apps with Phoenix.

Re:Elixir Is Erlang, not Ruby by cultofmetatron on Monday September 07, 2020 @08:29AM (#24398963)
I second that. Been working on a startup with our core system in elixir for a year now. I only wrote my first genserver 2 months ago and I've yet to touch protocols. I got pretty far with what you can learn in the first 2 weeks + some ecto specific nuances.
Re:Elixir Is Erlang, not Ruby by dnautics on Monday September 07, 2020 @10:52AM (#24399794)
IMO, Protocols (and to a lesser extent GenServers) are really there for library writers to write; if you're not writing a library, you probably shouldn't be using it.
Re:Elixir Is Erlang, not Ruby by Grimm1 on Monday September 07, 2020 @11:50AM (#24400206)
Heavy disagree, protocols are just an interface like solution and things that share a common set of functionality can probably benefit from utilizing a protocol.

GenServers I disagree with you on even more so since they can handle arbitrary messages (handle_info) it makes it a lot easier to do things like run a continuous process that does an action every n seconds as an example and also to handle life cycle messages from other processes. Oh my downstream consumer says things are finished handle a message that cleans up the children processes and shuts down the supervisor so we don't keep polling.

I use them to great effect in web crawling as a producer for things like Broadway and things like Agent or Task don't have the flexibility at the level I need it.