1. 12
  1. 3

    I didn’t know about Alice ML, but it sounds cool. I mentioned the pretty-printing problem in the last section of this post:

    http://www.oilshell.org/blog/2017/01/21.html

    I guess I’m too comfortable in dynamic language land. If a language has problems PRINTING/serializing its types generically, I let out a big sigh …

    I’m honestly surprised that there’s no well-maintained, production-quality, dynamic/reflective ML-like language. It seems like an obvious niche. Pyret seems like the closest thing, but as far as I understand, it’s a teaching language.

    That means I’m using this somewhat odd Python+ASDL combination for Oil, but it’s served me well so far. It will need to evolve though.

    Although honestly even looking at Alice ML, printing seems awkward:

    > import structure Reflect     from "x-alice:/lib/system/Reflect";
    > import structure PPComponent from "x-alice:/lib/system/PPComponent";
    > import structure PrettyPrint from "x-alice:/lib/utility/PrettyPrint";
    
    1. 4

      The Reflect and PPComponent imports are only required for deconstructing packages - the opaque value that can store any type. If you want to print any type you can just use PrettyPrint. For packages it’ll print package without deconstructing it though.

      Serializing is no problem with the pickle module.

      1. 4

        I’m honestly surprised that there’s no well-maintained, production-quality, dynamic/reflective ML-like language.

        F# might be the closest there. Because it’s on the CLR, you can use all the reflection features the CLR provides. Those on their own are a bit low-level when applied to F# (many F# features don’t exist at the CLR level, so are compiled down to lower level ones), but there’s a convenience library to allow some higher-level reflection. Brief overview here.

        1. 2

          Regarding dynamic ML, maybe this is what you’re looking for:

          https://lobste.rs/s/gexoss/dynamicml_dynamically_typed_version_sml

          1. 3

            Mozart/Oz is also close to a dynamic/reflective ML. With a bit of logic programming thrown in.

            1. 2

              Haha, good effort… would have been funnier if they didn’t take themselves so seriously :) I’ve heard the Harper “unityped” thing before and it is silly.

              1. 3

                So, I threw some more effort in since a dynamically-typed ML is useful. I found that there’s been a number of works on this sort of thing in CompSci but for minimalist languages as proof-of-concepts. It’s mostly been theory. There’s two I found in practice related to this question.

                Dynaml - Dynamic types for Ocaml (alpha):

                https://web.archive.org/web/20090105164828/http://farrand.net/dynaml.shtml

                Note: Links to manuals are dead in most versions of it I tried in Wayback. Proof of concept, though. Used that standard Ocaml parsing library (camp-something).

                Clean language has dynamic types:

                http://clean.cs.ru.nl/Language_features

                Note: A competitor to Haskell and Ocaml that has an interesting set of features. One of those features is optional, dynamic typing. It’s been around a while, too.

                An older one I remember is sklogic’s tool he uses for building compilers and tools for static analysis. He starts with a LISP-based foundation that facilitates his task. Then, he implemented as DSL’s Standard ML, Prolog, and a bunch of other things. So, depending on which is easier, he’ll switch back and forth between LISP or his DSL’s to express the solution the easiest way with the intended goals. I could see a different combination of LISP and SML for general applications that added dynamic typing.

                https://github.com/combinatorylogic/mbase

                1. 3

                  Implementing Standard ML, etc as DSLs reminds me of Poplog. It uses POP-11 as the core language and implements Scheme, Standard ML, Prolog, etc on top of it.

                  1. 2

                    I had heard of Poplog when I studied AI a long, long, time ago. I thought it was one of those LISP and Prolog combos. I didn’t know it was a meta-programming environment that could host many languages. Neat! :)

                    1. 1

                      Interesting, I didn’t know about Poplog! It seems like a nice, early example of a somewhat language-independent VM.

                      Thanks for the link!

            2. -2

              Nice