15

There are many dialects of ML, and SML and OCaml are most popular ones. There're many differences between SML and OCaml, but they are both considered as dialects of ML. So,

  1. Why SML and OCaml are considered as dialects of ML?
  2. How can a language be considered as a dialect of ML?
  3. If ML is not SML/OCaml, what is the definition of ML?

I guess ML is some intersection of SML and OCaml, but I can't find some detailed definition.

Pascal Cuoq
  • 79,187
  • 7
  • 161
  • 281
InsaneRabbit
  • 316
  • 1
  • 9

1 Answers1

9

The link from camlspotter has a nice overview of ML history, and mentions an implementation by Luca Cardelli called "Cardelli's ML". I poked around for that, and found this paper: ML under Unix. Luca Cardelli describes an implementation of "ML", and I'm pretty sure this would predate Standard ML as it's dated 1983. This is the list of features in the abstract:

  • interactive
  • strongly typed
  • polymorphic type system
  • abstract data types
  • exceptions
  • modules

This is a pretty good list, although some parts seem unclear. I think this list could serve as an informal definition of what features a language should have in order to be "considered an ML", however there are a couple of things worth noting.

The requirement that the system be "interactive" is a somewhat nit-picky implementation detail, perhaps specific to the implementation described in this paper. The Standard ML compiler MLton doesn't have an interactive REPL (because it's a whole-program optimizing compiler), however I doubt anyone seriously suggests the language MLton implements isn't ML.

Furthermore, "strongly typed" is pretty vague, so it's worth reading the rest of that paragraph for more context:

Every ML expression has a type, which is determined statically. The type of an expression is usually automatically inferred by the system, without need of type definitions. The ML type system guarantees that any expression that can be typed will not generate type errors at run time. Static typechecking traps at compile-time a large proportion of bugs in programs.

This list also doesn't mention pattern matching at all, however the paper does cover pattern matching, although I don't know if the ur-ML used in LCF had pattern matching, and if not, how one would manipulate data types without it. I would argue that in 2013, a language with these features, but lacking pattern matching, would be a tough to sell as an ML.

Note that Haskell mostly conforms to this list, if you squint a bit. But in practice it diverges enough that I think most people consider Haskell inspired by ML, but "not an ML", mostly because Haskell is pure and lazy while ML has historically been impure and strict. Furthermore, the ML module system, in both SML and OCaml, differs quite a bit from Haskell's, and neither of the MLs have typeclasses.

This isn't an exhaustive reply to all your questions, but I hope it helps nonetheless.

okonomichiyaki
  • 8,355
  • 39
  • 51
  • Thanks for your comments and link to ML Under Unix. I read the references and searched web and finally discovered a paper published in 1978 '[A metalanguage for interactive proof in LCF](http://www-public.int-evry.fr/~gibson/Teaching/CSC4504/ReadingMaterial/GordonMMNW78.pdf)'. And in this paoer authors wrote, 'A complete description of ML, and its use with PPλ, exists as a techical report: Edinburgh LCF, 1977'. I guess this might be the origin paper of ML. But I failed to find a n online version of it. – InsaneRabbit Jul 29 '13 at 06:09
  • And I guess there's no strict definition about being a dialect of ML. If some language has enough features of SML, it could be sold as dialect of ML. Just like 'Cloud Computing', there's no strict definition( there probably exists but who cares ). Nowadays everyone's products are cloudy. – InsaneRabbit Jul 29 '13 at 06:19
  • Interesting, nice find with that other paper, I wonder if this is the technical report mentioned: http://www.amazon.com/Edinburgh-LCF-Mechanized-Computation-Computer/dp/3540097244. Appears to be a few sections describing ML in the table of contents. – okonomichiyaki Jul 29 '13 at 13:01
  • probably. In the limited part I can access for free, I find some words can prove it. In 'How to read this document' section: if you are only interested in ML as a programming language, then.... And in preface section: ML is a functional language in the tradition of ISWIM and GEDANKEN. Its main features are: first,... you can find the part [here](http://link.springer.com/content/pdf/bfm%3A978-3-540-38526-4%2F1.pdf) – InsaneRabbit Jul 30 '13 at 01:50