Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCaml wishlist
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yaron Minsky <yminsky@c...>
Subject: Re: [Caml-list] OCaml wishlist
This seems pretty easy to achieve, although it's a bit messy.  Seems like
you might be able to clean it up with camlp4.  Here's the basic idea:


exception Return

let f ... =
  let rval = ref None in
  try
    ....
      rval := Some ...;
      raise Return
    ....
  with
      Return ->
	match rval with
	    None -> "Bug! function ended without returning"
	  | Some x -> x


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners