From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id D8ABD7F2AA for ; Tue, 18 Dec 2012 14:41:43 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of philippe.veber@gmail.com) identity=pra; client-ip=209.85.223.174; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="philippe.veber@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of philippe.veber@gmail.com designates 209.85.223.174 as permitted sender) identity=mailfrom; client-ip=209.85.223.174; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="philippe.veber@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f174.google.com) identity=helo; client-ip=209.85.223.174; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="postmaster@mail-ie0-f174.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As4BACRx0FDRVd+um2dsb2JhbABEvh4IFg4BAQEBAQgJCwkUJ4IeAQEEAScZARsdAQMBCwYFBAMEDS4iAREBBQEcBhOIAAEDCQaZbowzgXGBCoUXChknDVmIdgEFDJEAA5YKjmgWKYQV X-IronPort-AV: E=Sophos;i="4.84,309,1355094000"; d="scan'208";a="166188999" Received: from mail-ie0-f174.google.com ([209.85.223.174]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 18 Dec 2012 14:41:42 +0100 Received: by mail-ie0-f174.google.com with SMTP id c11so833743ieb.5 for ; Tue, 18 Dec 2012 05:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=/FoRXwm8YrswFJkWsKzu+7KSBpo3DVWaXJt4QlQ0Aps=; b=0yud6ktMLNljFt4jrJJvWq4j7asQMXJIgW0G4Uz8frdCE5dLtgd292jnhrjGTtbVfK urhIL5U1vSoaKi9vOUV/kjzdOUMoeq0aId+4edAdLl5wPsgPjwh9nVhBV67WSgTlKnaZ 4CD8z3F7kfG4OraZmLatRp8wUrwhoT3s+kyMVmMLpFFvUz3+Bv2hqO62Idvy3pY0tyQx /uTl+1/xaUaEmRh5mRceGqhXTWzAB5QHgA/W22eVyToLOrczFMXnLlz2hfTVxiXmOZaU /w2SYfVFfLFV2hmiWuhlh9gzPmIoOCE4FefkTtpjNGW3vDpUV8VUJB2z71s3GCLr89Ee kpCg== Received: by 10.43.110.132 with SMTP id ek4mr1980784icc.32.1355838101341; Tue, 18 Dec 2012 05:41:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.49.195 with HTTP; Tue, 18 Dec 2012 05:41:21 -0800 (PST) In-Reply-To: <50CF1EF8.6010503@coherentgraphics.co.uk> References: <50CF1EF8.6010503@coherentgraphics.co.uk> From: Philippe Veber Date: Tue, 18 Dec 2012 14:41:21 +0100 Message-ID: To: John Whitington Cc: caml users Content-Type: multipart/alternative; boundary=bcaec51717df67446004d120a8b2 X-Validation-by: philippe.veber@gmail.com Subject: Re: [Caml-list] ignore semantics --bcaec51717df67446004d120a8b2 Content-Type: text/plain; charset=ISO-8859-1 Hi John, That's a good reason indeed, good enough to justify having this special case semantics. Thanks! ph. 2012/12/17 John Whitington > 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/ > > --bcaec51717df67446004d120a8b2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi John,

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

ph.


2012/12/17 John Whitington <john@coherentgrap= hics.co.uk>
Hi,


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

=A0 =A0 =A0 =A0 =A0OCaml version 4.00.1

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

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

external ignore : 'a -> unit =3D "%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 (in= tentionally) ignoring the return value of the function.

Cheers,

--
John Whitington
Director, Coherent Graphics Ltd
http://www.cohere= ntpdf.com/


--bcaec51717df67446004d120a8b2--