<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/ed4b783ba287324e156a8716471da670"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-07-15T01:04:49"
  subject="Re: [Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?"
  prev="2003/07/0246c867e03ce642bf18a3fcaa245116"
  next="2003/07/eff20a82be9cc2e2ec8b6cff76a4b7c6"
  prev-in-thread="2003/07/f087c018f2b5dd9d20cee1fec0e2932e"
  next-in-thread="2003/07/03d042ad789734bfa71b3cc5a81d03b2"
  prev-thread="2003/07/54a6ceb53dfa0bd7ef618e45a55fec76"
  next-thread="2003/07/a7dc933f5630b69d8aaaade2b2a1795a"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?">
<msg 
  url="2003/07/f087c018f2b5dd9d20cee1fec0e2932e"
  from="henridf@l..."
  author="henridf@l..."
  date="2003-07-15T00:29:54"
  subject="[Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?">
<msg 
  url="2003/07/ed4b783ba287324e156a8716471da670"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-07-15T01:04:49"
  subject="Re: [Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?">
<msg 
  url="2003/07/03d042ad789734bfa71b3cc5a81d03b2"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-07-15T11:36:52"
  subject="Re: [Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?">
<msg 
  url="2003/07/28a24d1de6e0bfae026434e22611feed"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-07-16T00:11:13"
  subject="Re: [Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?">
<msg 
  url="2003/07/b2a1d888cd94e0bda8a7652de0bbadee"
  from="Jean-Christophe Filliatre &lt;Jean-Christophe.Filliatre@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2003-07-16T07:13:08"
  subject="Re: [Caml-list] &apos;should have type unit&apos; warning in &apos;let _ =&apos; ?">
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
From: henridf@lcavsun1.epfl.ch

&gt; i had a minor bug where the last expression in a 
&gt; let _ = ...
&gt; block of my module was not fully applied and hence was returning a 
&gt; functional value rather than apply the function (because I had added a 
&gt; parameter to the function).
&gt; 
&gt; pretty harmless, but it led me to wonder why I wasn't writing 'let () = 
&gt; ..' for all my module initialization blocks, which would have given me 
&gt; 'warning should have type unit' in the above situation.
&gt; 
&gt; So is there a reason why the commonly used idiom seems to be 'let _ =' 
&gt; rather than 'let () = '? 

I suppose this is the 1 character difference :-)
Programmers are lazy.
I've been advocating using "let () =" for a while now, and I am of
course using it myself.

By the way, there is a reason "let _ =" produces no warning: this is
the only way to do a partial application without warning.
"expr; ..." and even "ignore (expr); ..." will produce a warning.

By the way, I'm always disabling the s warning ("should be unit"), to
avoid being tempted by using "let _ = expr in " when I want to ignore
the result of a fully applied expression which does not return unit.
I know ignore does it, but I'm lazy too.

  Jacques

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

