Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
cdutchyn@cs.ubc.ca

-------------------
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