From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA08000; Tue, 6 Apr 2004 19:53:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA08013 for ; Tue, 6 Apr 2004 19:53:21 +0200 (MET DST) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i36HsCjq012700 for ; Tue, 6 Apr 2004 19:54:12 +0200 Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1BAulE-0005Cg-00 for ; Tue, 06 Apr 2004 18:53:20 +0100 Date: Tue, 6 Apr 2004 18:53:20 +0100 Cc: Ocaml Subject: Re: [Caml-list] Function forward declaration? Message-ID: <20040406175320.GA19840@redhat.com> References: <60532B15DF92FD4693AA89B2F7E01D8F013F29EC@tmex02> <00cf01c41bd6$391b53a0$0203a8c0@hoedic> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 brogoff:01 recursion:01 faq:01 val:01 val:01 proto:01 type-safe:01 ltd:98 compiler:01 compiler:01 caml:01 caml:01 0700,:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 80 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