News for hackers. Stuff that matters.
Re:Ask HN: So, what's up with Phoenix (web framework)? by vasergen on Saturday August 20, 2022 @09:29AM (#32531925)
What is your experience with refactoring, especially a big project? This is where static typing helps a lot ihmo. Especially if you are in a startup like environment where things tend to change quickly.
Re:Ask HN: So, what's up with Phoenix (web framework)? by yellowapple on Sunday August 21, 2022 @06:53AM (#32538955)
Funny you ask that, since I have indeed refactored OTPCL (a sort of Erlang-flavored Tcl-flavored scripting/config language I've been on-and-off hacking on for the last couple years) multiple times now, namely to rewrite the parser and to rewrite how command exports work - so the commit history should reflect some of the pitfalls and boons I encountered.

I actually did pursue static typing (w/ type annotations and Dialyzer) at one point, but quickly lost interest, since it didn't really seem to add much. Having comprehensive tests, on the other hand, was crucial - especially since I could use pattern matching within those tests to make assertions about expected inputs and outputs.

I will say that there were bugs that compile-time type checking probably would've caught, but tests also readily caught them. The same can likely be said for current bugs. It's ultimately the same idea: validate that your code adheres to the expected API and behavior; only difference is that the validation happens in different places.

Re:Ask HN: So, what's up with Phoenix (web framework)? by chasers on Saturday August 20, 2022 @10:02AM (#32532125)
Pattern matching and structs get you 90% of the way there imo. And Elixir started emitting warnings if you try to access a field in a struct and it doesn't exist.