I recall reading somewhere (can't find it now) that Moscow ML is incorrect, but that it was done deliberately for efficiency reasons, the thinking being that it would be unlikely to be an issue in practice.

That is (as I recall), in f x1 x2 x3 (f not an application)
it will evaluate _all_ the arguments before evaluating _any_ of the applications

Peter - is this correct ?

Regards,

Jeremy Dawson

Ivan Tomac wrote:
Is the following code supposed to print 1 followed by 2 or 2 followed by 1?

val _ = (fn () => (print "1\n"; fn x => x)) () (print "2\n"; ())

In SML/NJ, MLton and PolyML it does the former, while in Moscow ML it
does the latter. Is this specified somewhere in the standard? I
noticed equivalent code in OCaml behaves the way Moscow ML does which
is not very surprising seeing how Moscow ML was based on Caml Light.
Could this be a bug in Moscow ML?

The following code works the same in all 4 SML compilers (but
different in OCaml):

val _ = (print "1\n"; 1) + (print "2\n"; 2)

It seems to me like SML/NJ, MLton and PolyML evaluate all function
arguments left to right, OCaml evaluates them right to left, and
Moscow ML seems inconsistent.
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to