From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3S8rfTh030708 for ; Thu, 28 Apr 2011 10:53:41 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkYHANYquU1c8w3B/2dsb2JhbACYT40ud8JZhXYEnGc X-IronPort-AV: E=Sophos;i="4.64,279,1301868000"; d="scan'208";a="106964759" Received: from dangi.happyleptic.org ([92.243.13.193]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 28 Apr 2011 10:53:36 +0200 Received: from extranet.securactive.org ([82.234.213.170] helo=ccellier.rd.securactive.lan) by dangi with esmtp (Exim 4.72) (envelope-from ) id 1QFN05-0004Q0-Ar for caml-list@inria.fr; Thu, 28 Apr 2011 10:55:05 +0200 Received: from rixed by ccellier.rd.securactive.lan with local (Exim 4.72) (envelope-from ) id 1QFMyY-0005b6-6a for caml-list@inria.fr; Thu, 28 Apr 2011 10:53:30 +0200 Date: Thu, 28 Apr 2011 10:53:30 +0200 From: rixed@happyleptic.org To: caml-list@inria.fr Message-ID: <20110428085330.GA18913@ccellier.rd.happyleptic.org> References: <20110427204629.GA8872@yeeloong.happyleptic.org> <20110427205416.GL4023@localhost> <20110427212852.GC8872@yeeloong.happyleptic.org> <20110427215146.GD4023@localhost> <244248468.756230.1303963610378.JavaMail.root@zmbs4.inria.fr> <4DB91692.5000305@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DB91692.5000305@inria.fr> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Strange behavior of mutualy recursive definitions -[ Thu, Apr 28, 2011 at 09:26:10AM +0200, Fabrice Le Fessant ]---- > On 04/28/2011 06:06 AM, rixed@happyleptic.org wrote: > > Although "let rec f = f" is unsound and rejected as expected, > > why is "let rec f : unit -> unit = f" also rejected, since it seams > > trivially equivalent to "let rec f () : unit = f ()" (which is > > accepted) ? > > Eta-conversion (transforming "let f = f into let f () = f ()") is > unsound in the general case. Indeed, take for example: > > let f () = print_string "titi"; function () -> print_string "toto" > > Is "let g = f ()" equivalent to "let g () = f () ()" ? No. > > So, no eta-expansion is ever performed using only type information. Oh, you are right! I really couldn't imagine a case where they were not equivalent. So I was wrong (and a little bit ridiculous) when I asserted that "let f = g" is "trivially" (!! :-)) equivalent to "let f x = g x" when the signature of g is known. That's fine. The other shorter syntax was more appealing but I will be more cautious with it from now on.