<?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/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; ?"
  prev="2003/07/8abf4736210b0660fe0c16d517643761"
  next="2003/07/155910c4eeb09e684f02ea4ae342873b"
  prev-in-thread="2003/07/03d042ad789734bfa71b3cc5a81d03b2"
  next-in-thread="2003/07/b2a1d888cd94e0bda8a7652de0bbadee"
  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: Richard Jones &lt;rich@annexia.org&gt;
&gt; On Tue, Jul 15, 2003 at 10:04:36AM +0900, Jacques Garrigue wrote:
&gt; &gt; By the way, there is a reason "let _ =" produces no warning: this is
&gt; &gt; the only way to do a partial application without warning.
&gt; &gt; "expr; ..." and even "ignore (expr); ..." will produce a warning.
&gt; 
&gt; Interesting ... what's the use of a partial application which is
&gt; then ignored?

The same as all application whose result is ignored: side effects.
I know this is quite rare. (I can remember using this only once.)
But it would be disturbing to make it completely impossible.

Or is it not so important?
Actually I wonder whether it would not be safer to simply warn for all
unused partial applications in a compiled program. This is a bit
subtle, as one has to keep track of unused variables too (functions
defined by partial application which are never used).

A middle ground would be to only warn when the wild pattern matches a
function type, assuming that when you name something you know what
you are doing. This would be mostly compatible: you just have to name
the pattern when you want to discard a function. As a nice aside, it
would avoid most uses of "ignore".

By the way, my personal approach would be to let programers declare what
they want: remove the "should be unit" warning (it can be easily
enforced by "let () = ... in"), and remove all warnings on "ignore",
since you could then write "let _ = ... in" if you want the partial
application warning. But this is maybe expecting too much from
programmers.

Comments?

Jacques Garrigue

-------------------
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>

