1. 19
  1.  

  2. 11

    I say it as much as I can: Typescript’s Type system is … essentially the mos useful type system for “everyday software” I have ever used. The fact that unions, intersections, “keyof”, conditionals are all easy to use actual first class parts of the system (Maybe is not a first class optional! thing | null very much is), means you can build very specific types and _actually crush bugs.

    Of course the sound-ness issues don’t make it a good type system for people who want to use it for compilation. But I really wish I could graft Typescript onto python instead of mypy.

    1. 3

      Maybe is not a first class optional! thing | null very much is

      I object to this; the only thing that changes are the control flow structures and the syntax that you use to interact with the types. T | null is certainly much more first class in Javascript than any tagged optional would ever be though.

      1. 2

        I strongly recommend you look at the path not taken: Ceylon. It’s type system is designed to solve “real programmer problems”.

        And I love Mypy, but I agree it’s not 100% there yet. It’s getting there, though.

        1. 1

          Could you elaborate on your Ceylon comment? Reading through the type system information, there are references to things I see in other systems. (Fully reified type system, union/intersection types, mixins, etc.)

          1. 2

            Not much more than that, really. Ceylon came out around the same time as Go and Rust, but lost out to both of them. The goal was, as far as I can tell, to create a type system that was designed to solve “real problems” and not just be theoretically pure. For example, it was one of the first (maybe the first?) languages to have flow typing.

            (Reading it turns out Whiley had flow typing about a year before Ceylon…)

            I’ve always really liked Ceylon and its type system, and I’m saddened that it was the road not taken. I get why it lost (it targeted two very different platforms with, leaned too heavily on being a JVM language, etc), but it is a beautiful language. Other languages are catching up, but Ceylon I still think has some stuff worth studying.

        2. 1

          Plot twist: you can ;)

          1. 2

            link plz?!!?

            1. 2

              I meant I have faith in anyone who sets out to create TypeSnake. RattleTyped? Heh.

          2. 1

            essentially the mos useful type system for “everyday software” I have ever used.

            Actually the TypeScript type system was explicitly designed to be “programmer friendly” so that “when you type dot useful results appear” (paraphrasing Anders Hejlsberg) not for some abstract sense of pureness (source: interviews with Anders on Channel9).

          3. 4

            Incidentally the type system is Turing complete. There is a talk by Anders Heljsberg on how they have a termination cutoff so that they don’t loop infinitely when the programmer accidentally encodes a loop with the types.

            1. 2

              Yes, a little bit of context for people interested in this: https://github.com/Microsoft/TypeScript/issues/14833