5 ms·
Static typing is far from a panacea. Don't forget that the rise of Perl and PHP, and then later Ruby and Python was in response to statically typed languages li
by AlchemistCamp 7y ago
Static typing is far from a panacea. Don't forget that the rise of Perl and PHP, and then later Ruby and Python was in response to statically typed languages like Java.
There are trade-offs.
- conradfr 7y agoTo be fair PHP, while still dynamic, has eventually evolved to be (optionally) a strict and strongly typed language.
- mcintyre1994 7y agoI agree, I wasn't trying to imply otherwise. It's just that static typing is the first thing that looks like a theoretical trade-off of Elixir based on my experience, and I was curious why it doesn't feel that way in practice.
- AlchemistCamp 7y agoStructs and pattern matching help quite a bit.
- paultannenbaum 7y agoDialyzer via Dialyxir also helps as well
- andy_ppp 7y agoOne of the things I like about Guards is that you can enforce/match against types as needed.
- theonething 7y agoGuards are nice, but compared to static typing, they a run time check whereas static typing alerts you to errors at compile time.
- 1_player 7y agoGuards are mostly used to do pattern matching, not to specify which types a function accepts, though you can use them as such.
- andy_ppp 7y agoI’m a fan of static types don’t get me wrong, I’m just saying with guards and dialyser it’s 60% of the way there compared to nothing. Also I don’t seem to make to class of errors I do in other languages because 90% of this time passing the wrong thing breaks immediately due to pattern matching.
- nickcox 7y agoDon't Perl and PHP both predate Java? By quite a bit in Perl's case.
- pmontra 7y agoThe rise in popularity can happen later than the creation of a language, see Python (1991). In my case I left Java for Ruby for web programming in 2006 because working with Rails was infinitely easier than working with Structs. I didn't even know that Ruby was a programming language before Rails.
- mtnGoat 7y agoFWIW: Perl, 1987. PHP & Java, 1995.
- gfxgirl 7y agoWhat I want hear on static types vs dynamic is how it plays out on a team of say 30 to 100 people. I love JavaScript when it's just me but I much prefer types when using someone else's code because they provide guidance that otherwise isn't there.