Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Design Principles of the Elixir Type System (programming-journal.org)
62 points by mpweiher on Jan 10, 2024 | hide | past | favorite | 19 comments


Elixir is going in a very interesting direction, it may be the Language to I will learn this Year

The work on the type System seems to be going well and the work on machine learn is starting to get attention


Are there any other examples of a programming language adding a type system after the fact?


Elixir (and erlang) already has a type system, it’s just dynamic.

Python and typescript both added stricter typing to their respective languages


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.


Elixir 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


Yes but until you run another program the type is just data that gets thrown away. It is effectively just a more syntactically strict comment.


It is a Strongly Typed language (and always has been), It's just Dynamically Typed.


That’s just not true.

Look at function guards


It 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).


Okay 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!


What is code but interpreted text? If the comments are interpretable and enforced by a logical system, then they become instruction.


Functions 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


Yes, I should have specified a Static type system


Not part of the official language spec, but Ruby has Sorbet, from a company who employs Ruby core contributors and helped with the recently released JIT additions to the language, among countless other contributions over the last couple decades.

https://sorbet.org/


Dart went from a full dynamic system to a statically verified traditional system with null safety.


I presume you mean migrate from dynamic to static. check out Dart.


PHP


typescript?


Kinda ... it was built with types from the start, though I guess you could argue Typescript = Javascript + Types




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

Search: