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

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.



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.


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.




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

Search: