4 ms·
I don't think it's actually fair to say Elixir has a type system. There are expressions that are specially handled at the compiler level, but are mostly ignored
by krainboltgreene 3y ago
I don't think it's actually fair to say Elixir has a type system. There are expressions that are specially handled at the compiler level, but are mostly ignored unless you invoke another separate system. It's effectively comments that have syntax.
- h0l0cube 3y agoIt has a gradual type 'system', along with a means of type checking (via Dialyzer) at compile time. However the type checking isn't enforced at compile time, and it has the possibility for some false negatives (though it isn't so bad in experience).
- krainboltgreene 3y agoOkay then by that measure comments with details about input and output are also a type system, an even easier one since there's generally only one syntax rule!
- h0l0cube 3y agoWhat is code but interpreted text? If the comments are interpretable and enforced by a logical system, then they become instruction.
- dartos 3y agoFunctions can have pattern matching and guards which act as type safety measures, granted they are runtime and not as robust as, say, rust’s type system
- dartos 3y agoElixir has a clear concept of a “type” and can’t just change one type of data to another Willy nilly. Sounds like a type system to me. It’s even stricter than JavaScript, as it doesn’t silently try to coerce everything into a string
- krainboltgreene 3y agoYes but until you run another program the type is just data that gets thrown away. It is effectively just a more syntactically strict comment.
- weatherlight 3y agoIt is a Strongly Typed language (and always has been), It's just Dynamically Typed.
- dartos 3y agoThat’s just not true. Look at function guards