1. 52
  1.  

    1. 9

      For more info about Elixir’s type project, check out: https://elixir-lang.org/blog/2023/06/22/type-system-updates-research-dev/

      I’ve found it really interesting to watch a static type system be added to an existing language. Many others have done it (Python, TS, etc) so it’s always cool to see how approaches are structured with the benefit of that hindsight.

      1. 4

        I’m quite pleased that unless is on the way out. It’s an unnecessary duplication of if ! in the language grammar and I found it invariably harder to comprehend than an if. Not only that, it also creates an additional complication for code analysis tools like Credo.

        I’m guessing it was something that was originally borrowed from Ruby which has a very idiosyncratic (and in my view misguided) notion of readability and programmer convenience.

        1. 4

          unless comes from CPL -> BCPL -> Perl -> Ruby

          CPL and BCPL have eccentric conditional statements because Strachey had a fierce objection to the way “else” is used in Algol (et seq.), being “bad English” — which is true, it was an unidiomatic translation from German suggested by the European (mostly German) half of the Algol committee.

          1. 2

            What a good decision. unless might be one of my least favorite things in Ruby.

          2. 3

            Very exciting stuff. I really love how, as an Elixir user, I’m going to benefit from the changes made here in a concrete way without any changes to my existing programs.

            Elixir is in a unique spot when it comes to adopting stricter typing paradigms.Erlang and its descendants have a fundamentally stricter type system than OO dynamic language by default, as the set of built-in types is both all-encompassing and more concrete. Structural matching is widespread in the ecosystem and Elixir uses that as the basis for type-system features like structs and protocols, which is how you get the compile-time type-checking for “free” now. :)

            1. 1

              as the set of built-in types is both all-encompassing and more concrete

              Could you expand on what these two properties mean?