1. 14
  1.  

  2. 1

    Does anyone know of some guide on how to add static typing to a language, that would be easy to understand to a “commercial” programmer (i.e. avoiding the mathy/CompSci type-theory “equations”, or translating them from CompSci lingo to ELI5 programmer lingo)? Ideally still covering the now-mandatory extensions like composite types (e.g. structs, arrays, inheritance/structured typing, etc.). “Type deduction” (e.g. Hindley-Milner) would be cool but not strictly required (most of those that I could find seemed to not be able to resist the temptation of going the CompSci-lingo path).

    Apart from trying to understand H-M, I remember also watching some reportedly “simple” YouTube video about mini- (or micro-?) -Kanren, and it seemed to start somewhat approachable, but the guy was talking rather fast and he couldn’t resist spiralling it out of control to rather dense format rather quickly, so I lost it too :’-(

    IIUC a GC is something you can even “plug in” as a library (I believe Boehm is distributed as such?), whereas static typeing seems to be something you must bake into your language design, and that will actually influence it a lot, so I’d love to learn that…

    1. 3

      IIUC a GC is something you can even “plug in” as a library…

      It can be, but it also starts to enable very different ways of thinking about and handling data. A language with GC built into it from the beginning tends to look quite different than one without.

      1. 1

        Does anyone know of some guide on how to add static typing to a language, that would be easy to understand to a “commercial” programmer

        “ELIC”. Nice.

        An easy way to implement static typing is to simply implement your interpreter twice: The second “run” is your type-checker, where all of your primitives are implemented in such a way that they return the types of their arguments instead of evaluating them.

        IIUC a GC is something you can even “plug in” as a library (I believe Boehm is distributed as such?),

        It can be, but these sorts of GC do not tend to perform very well or have some limitations that might not be desirable in some production environments, so it usually benefits the language to consider GC carefully.

        ECL (a lisp that compiles to C and uses Boehm as its GC that I used to work on) is significantly slower than many other lisp compilers, and this is a big part of “why” that is, of course the advantage is that interfacing with C code is substantially easier than in other compilers.

      2. 1

        I think this is a couple years old, not 2020, though it may have been updated recently.