Hi John,

That's a good reason indeed, good enough to justify having this special case semantics. Thanks!

ph.


2012/12/17 John Whitington <john@coherentgraphics.co.uk>
Hi,


Philippe Veber wrote:
This is a rather minor issue, but I was surprised by the following
answers of the interpreter:

         OCaml version 4.00.1

# ignore succ;;
Warning 5: this function application is partial,
maybe some arguments are missing.
- : unit = ()
# (fun _ -> ()) succ;;
- : unit = ()

I naively used to think the two expressions were equivalent. Reading
pervasives.mli, I found that ignore is a primitive:

external ignore : 'a -> unit = "%ignore"

which means it is treated as a special case. Just for curiosity, what is
the rationale for the warning in the first case?

Imagine you wrote:

ignore (output_something_and_return_something)

When what you wanted was

ignore (ouput_something_and_return_something ())

You'd want the partial application error there, even though you are (intentionally) ignoring the return value of the function.

Cheers,

--
John Whitington
Director, Coherent Graphics Ltd
http://www.coherentpdf.com/