[MLton] A Possible "Bug"?

Henry Cejtin henry.cejtin at sbcglobal.net
Fri Dec 18 06:15:17 PST 2009


I  would  say  that  MLton is correct and SML/NJ is wrong.  The point is
that the left hand side of the binding in
    val [[x]] = []
is a non-exhastive pattern and the right hand side does not match any of
the  cases.  (The type is correct though.)  Hence evaluating this should
result in the Bind exception being raised.

At least in v110.67 of SML/NJ, that is what happens.

Perhaps you are being confused by the fact that  the  exception  raising
happens  at  evaluation  time.   In  MLton,  that  is  when  you run the
executable, but in SML/NJ, it is when you enter the  expression  to  the
read-eval-print loop.

Note,  if  SML/NJ  did  not  issue a warning about the binding not being
exhaustive then that would be a bug in their code.




----- Original Message ----
From: Baojian Hua <huabj at mail.ustc.edu.cn>
To: mlton <mlton at mlton.org>
Sent: Fri, December 18, 2009 4:02:57 AM
Subject: [MLton] A Possible "Bug"?

...

However, I happened to run this code:
val [[x]] = [];

MLton reports a warning message, but smlnj-110.71 reports
an error (compiler bug?). I'd like to ask here that which 
behaves correctly?



More information about the MLton mailing list