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: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Function forward declaration?
On Tue, Apr 06, 2004 at 10:39:26AM -0700, 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.


Richard Jones.
Merjis Ltd. - improving website return on investment
MOD_CAML lets you run type-safe Objective CAML programs inside the Apache

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