A fine example, but I prefer one which avoids ref's. Just replace the increment of r with `print "hello\n"'. I'm assuming that the old SML only noticed refs in its imperative/weak type variables, but not effects like that.