Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Writing typespecs (+ guards) feels really outdated and a drag, especially in a language that wants you to write a lot of functions.

It reminds of the not-missed phpspec, in a worst way because at least with PHP the IDE was mostly writing it itself and you didn't need to add the function name to them (easily missed when copy/pasting).



I wouldn't lump guards and typespecs together. Guards are a runtime feature of erlang/elixir's excellent pattern matching.

Typespec is an opt-in type hint for develop and build time.


True but by using guards + pattern matching structs you can approximate type hinting, but it feels cumbersome and more of a workaround than a real solution.


I'm of the opinion that Erlang/Elixir are terrible for repeat tasks like a standard CRUD server over a SQL database. Because yes, it IS cumbersome! Behaviors and type hints only get so far, and it is exhaustingly slow to sit with epgsql in the REPL to figure out what a query actually returns.

I find them much better suited for specific tasks where there is little overlap or repetition.




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

Search: