From mboxrd@z Thu Jan 1 00:00:00 1970 X-Sympa-To: caml-list@inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3S6U8ji024739 for ; Thu, 28 Apr 2011 08:30:08 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsYFANoIuU1QW+UMgWdsb2JhbACYUY0uFAEBFiYliHC6JYV2BIYHlx8 X-IronPort-AV: E=Sophos;i="4.64,278,1301868000"; d="scan'208";a="81899828" Received: from lo.gmane.org ([80.91.229.12]) by mail3-smtp-sop.national.inria.fr with ESMTP; 28 Apr 2011 08:30:08 +0200 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QFKjm-0000uI-PL for caml-list@inria.fr; Thu, 28 Apr 2011 08:30:06 +0200 Received: from b2.da.79ae.static.theplanet.com ([174.121.218.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 Apr 2011 08:30:06 +0200 Received: from jeffsco by b2.da.79ae.static.theplanet.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 Apr 2011 08:30:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Jeffrey Scofield Date: 28 Apr 2011 01:24:33 -0500 Sender: jeffsco@pse.psellos.com Message-ID: References: <20110427204629.GA8872@yeeloong.happyleptic.org> <20110427205416.GL4023@localhost> <20110427212852.GC8872@yeeloong.happyleptic.org> <20110427215146.GD4023@localhost> <20110428040550.GB9733@yeeloong.happyleptic.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: b2.da.79ae.static.theplanet.com User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Validation-by: jeffsco@psellos.com Subject: [Caml-list] Re: Strange behavior of mutualy recursive definitions rixed@happyleptic.org writes: > Why 'let rec f = f' is rejected is clear: you cannot type f. In my thinking, f is typeable with type 'a (fully general type). I don't think it's untypeable, it just doesn't have a useful type. It's similar to the type of failwith : string -> 'a, but without the string. In Haskell the equivalent definition has useful purposes. It represents "bottom" (erroneous computation). In a strict language you can't have such a value hanging around, seems like. So in OCaml you have failwith instead (a lazy version of an erroneous computation). So to me it makes sense that it's rejected not on typing but on other grounds. It's also worth noting that let rec f x = f x is just a shorthand for let rec f = fun x -> f x This also is typeable with type 'a -> 'b. Again this isn't a very useful type, but there's no problem with this value in a strict language, because the lambda ("fun") essentially makes it lazy. Jeffrey