Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2003-10-21 (19:46)
From: Alain.Frisch@e...
Subject: Re: [Caml-list] OCaml wishlist
On Tue, 21 Oct 2003, William Lovas wrote:

> I don't think it would be beneficial in the long run to clutter up the core
> language with these sorts of purely syntactic issues

Not quite. Even without escaping loops, the "return" statement is more
than syntax. Consider:

let f x =
  match .. with
   | .. ->
       let .. = (if ... then return "Booh!" else ...)

In some cases, GOTOs^Wstatic exceptions are just a decent solution to
shortcut the normal functional control flow, and much more efficient than
dynamic exceptions. Internally, OCaml has such a mechanism (see
bytecomp/lambda.mli, Lstatic* constructors, used for the compilation of
pattern matching), which, I guess, could be quite easily be exposed in a
type-safe way to the surface language. Note that I'm not really asking for
such a feature.

-- Alain

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: