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] Function forward declaration?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-07 (18:44)
From: Christopher Dutchyn <cdutchyn@c...>
Subject: Re: [Caml-list] Function forward declaration?

On Wed, 7 Apr 2004, Basile Starynkevitch wrote:

> For your information, the revised syntax (provided by camlp4) does
> have (IIRC) a return keyword (but I don't remember more, and I never
> used it).

The return keyword in the revised syntax does not do what Richard wants.
In particular, the revised syntax supports (as deprecated syntax)

	do 1; 2; return 3

as an expression.  Note that return is used solely to mark the terminal
expression in the sequence, not to obtain an early exit.  Specifically,
it allows one to omit the braces from the identical expression:

	do { 1; 2; 3 }

In particular, this doesn't work

	let i = ref 10 in
	while (i.val = 0) do {
		if i.val = 7 then
                   return i.val  (* or blank or anything *)
                else i.val := i.val - 1

Interestingly, the deprecated syntax is not included in the reference and
tutorial manuals for camlp4.

Chris Dutchyn

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