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: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Function forward declaration?
On Tue, Apr 06, 2004 at 10:39:26AM -0700, brogoff@speakeasy.net wrote:
> There was a discussion of this a looooong time ago, in the context
> of supporting polymorphic recursion in the language, and I believe
> it was mentioned that some experimental Caml compiler had a forward
> declaration capability. It seems like a good idea, and I wonder why
> it hasn't made it into the language, as this is a FAQ and a language
> blemish.

I was wondering this too.  Is there some reason why we couldn't
add a way to do forward declarations, eg:

val g : unit -> int		(* prototype; val is already reserved word *)

let f () = (* ... *) g ()

(* some intervening code which makes it difficult to use let rec ... and *)

let g () = (* ... *) 42		(* compiler checks that g matches proto *)

?  Seems it would preserve type safety.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MOD_CAML lets you run type-safe Objective CAML programs inside the Apache
webserver. http://www.merjis.com/developers/mod_caml/

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