Hi John,
That's a good reason indeed, good enough to justify having this special case semantics. Thanks!
ph.
Hi,Imagine you wrote:
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?
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/