26 ms·
Elixir is cool, I used to use it for web app backends before adopting TypeScript and Rust. The reason I adopted them was the same reason I stopped using Elixir
by satvikpendem 3y ago
Elixir is cool, I used to use it for web app backends before adopting TypeScript and Rust. The reason I adopted them was the same reason I stopped using Elixir after a while: type safety. It was getting increasingly hard to be productive in Elixir in a large application due to runtime type errors that are caught in statically typed languages.
- cpursley 3y agoI've found that pattern matching in the function head and guards get you most of the way there.
- satvikpendem 3y agoYes however I get that in TS and Rust while also having stronger type guarantees. I don't think pattern matching is an alternative to static types, it's a supplement.
- weatherlight 3y agoRust, sure. Love me some Rust. Typescript's type system isn't sound and you can still get runtime errors. (Type systems should be bomb-proof or just get out of the way.)
- johnisgood 3y agoWell, I suppose to each their own. I use languages with and without static typing. I love Ada the most though, because the way you define types is very different from the most widespread way. In Ada, you define the range. Examples: type Day is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); subtype Business_Day is Day range Monday .. Friday; subtype Weekend_Day is Day range Saturday .. Sunday; subtype Dice_Throw is Integer range 1 .. 6; type Arr_Type is array (Integer range <>) of Character; type Color is (White, Red, Yellow, Green, Blue, Brown, Black); type Column is range 1 .. 72; type Table is array(1 .. 10) of Integer; type Device_Register is range 0 .. 2**5 - 1 with Size => 5; type Commands is (Off, On); type Commands2 is new Integer with Static_Predicate => Commands in 2 | 4;
- cpursley 3y agoIs there pattern matching in TS function heads?
- johnisgood 3y agoStrange, I cannot recall the last time I ran into one and I write a lot of Erlang. Both Erlang and Elixir share the "Let It Fail" philosophy, additionally it is also highly encouraged to use pattern matching, guards, and error-handling techniques to deal with potential type-related issues and errors. On the other hand, I get it all the time with Python, for example.
- hmmokidk 3y agoHow tested were your applications?