A Funny Distinction between SML and OCaml

The ML (meta language) family of programming languages has been fairly influential, especially across the functional programming world. Two well-known dialects are Standard ML (developed by British academics, chiefly at the University of Edinburgh) and OCaml (developed by French academics, chiefly at Inria). The two languages are pretty similar, but there are a few differences. For one, Standard ML uses a left-to-right evaluation semantics, so that

(* Standard ML *)
(print "A", print "B")

will print out "AB". On the other hand, OCaml uses a right-to-left evaluation semantics, so that

(* OCaml *)
(print_string "A", print_string "B")

will print out "BA". The joke is that this difference is because the British drive on the left side of the road and the French on the right!

Credit to Bob Harper, who made this joke in class yesterday.


Comments

Submit a comment

Your comment will be held for moderation. If needed, I'll reach out to the provided email address with moderation updates. Your email will not be publicly displayed.

Note: comments are still in beta. Let me know if anything is broken!