<div dir="ltr">CCing the list. I guess you intended to cc but forgot.<div><br><div class="gmail_extra"><div class="gmail_quote">On 24 February 2017 at 09:27, <span dir="ltr"><<a href="mailto:ok@cs.otago.ac.nz" target="_blank">ok@cs.otago.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In Erlang, the equivalent of a let fails.<br>
1> 1=2.<br>
** exception error: no match of right hand side value 2<br>
<br>
In SML, the equivalent of a let fails.<br>
- val 1 = 1;<br>
- val 1 = 2;<br>
<br>
uncaught exception Bind [nonexhaustive binding failure]<br>
raised at: stdIn:2.5-2.10<br>
<br>
The problem is not that let 1 = 2 ... is *legal* but that<br>
- the compiler is *silent* about it<br>
- the runtime is *silent* about it.<br>
Compiling the little program<br>
<br>
main = let 1 = 2 in print "hi"<br>
<br>
I expected that the compiler would be silent but that<br>
there would be some sort of "matched failed" error at<br>
run time. Silly me.<br>
<br>
<br>
The thing is, it is not just bindings that bind no variables<br>
that act as if they were not there.<br>
<br>
main = let [x] = [1,2] in print "hi"<br>
<br>
also compiles silently and runs without error. Change it to<br>
<br>
main = let [x] = [1,2] in print ("hi" ++ show x)<br>
<br>
and you get a runtime error<br>
<br>
<object>: <source>: Irrefutable pattern failed for pattern [x].<br>
<br>
I wish the compiler would report an error something like<br>
<br>
"<location>: possibly failing match deleted<br>
because it binds no live variables"<br>
<br>
<br>
<br>
</blockquote></div><br></div></div></div>