Browse thread
break and continue for OCaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2008-04-10 (14:19) |
From: | Richard Jones <rich@a...> |
Subject: | Re: [Caml-list] break and continue for OCaml |
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