From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id AB399BBC1 for ; Thu, 10 Apr 2008 16:19:35 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEACq//UfAXQIn/2dsb2JhbACrWw X-IronPort-AV: E=Sophos;i="4.25,636,1199660400"; d="scan'208";a="10703526" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Apr 2008 16:19:35 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m3AEJVV3004800 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 10 Apr 2008 16:19:35 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskAAO6+/UdQRFuwiGdsb2JhbACRSgEBAQ8mmVw X-IronPort-AV: E=Sophos;i="4.25,636,1199660400"; d="scan'208";a="24845804" Received: from furbychan.cocan.org ([80.68.91.176]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Apr 2008 16:19:35 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1Jjxck-0001wy-40; Thu, 10 Apr 2008 15:19:34 +0100 Date: Thu, 10 Apr 2008 15:19:34 +0100 To: Martin Jambon Cc: caml-list@inria.fr Subject: Re: [Caml-list] break and continue for OCaml Message-ID: <20080410141933.GC4065@annexia.org> References: <5b0248170804091859s75c3f725s2db53f48fba6735c@mail.gmail.com> <20080410133956.GA4065@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Miltered: at concorde with ID 47FE21F3.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 0200,:01 struct:01 compiler:01 10,:98 shorthand:98 wrote:01 caml-list:01 jambon:01 behaviour:01 lazy:02 lazy:02 module:03 internals:03 let:03 On Thu, Apr 10, 2008 at 04:05:45PM +0200, Martin Jambon wrote: > I'm OK with the intent, but what should happen in such cases: > > module A = > struct > let a = break > let b = continue > let c = return true Assuming we can tell if we're inside a function[1] then 'c' would be an error. > let d = lazy (return 123) let d () = lazy (return 123) is an interesting case because in theory the behaviour could end up looking like a continuation. However if you consider 'lazy' to be a kind of shorthand for 'fun () -> ...' then the answer is more obvious; this is just the same as: let d () = lazy 123 > let e () = Lazy.force d and the outcome of 'e ()' is then also obvious. Rich. [1] .. and not being an expert on the internals of the compiler I don't really know if this assumption is true. -- Richard Jones Red Hat