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 IAA11862; Wed, 7 Apr 2004 08:03:52 +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 IAA11425 for ; Wed, 7 Apr 2004 08:03:51 +0200 (MET DST) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3764hjq019670 for ; Wed, 7 Apr 2004 08:04:43 +0200 Received: from warp (chateaudeau-4-82-225-176-25.fbx.proxad.net [82.225.176.25]) by postfix4-1.free.fr (Postfix) with SMTP id B3DE3DD427; Wed, 7 Apr 2004 08:03:49 +0200 (CEST) Message-ID: <002901c41c65$b53e4c50$19b0e152@warp> From: "Nicolas Cannasse" To: "Marcin 'Qrczak' Kowalczyk" , References: <60532B15DF92FD4693AA89B2F7E01D8F013F29EC@tmex02> <00cf01c41bd6$391b53a0$0203a8c0@hoedic> <20040406175320.GA19840@redhat.com> <1081279717.16531.6.camel@qrnik> Subject: Re: [Caml-list] Function forward declaration? Date: Wed, 7 Apr 2004 08:01:01 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 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; cannasse:01 warplayer:01 caml-list:01 val:01 val:01 proto:01 stupid:01 cannasse:01 compiler:01 compiler:01 nicolas:01 nicolas:01 imho:01 int:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 86 > 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 *) > > What would this code do? > > val g : unit -> int > let f () = g () > let x = f () > let y = x + 1 > let g () = y What about "compilation error : recursive calls in forward declaration" ? And what would this code do ? let f () = while true do () done That's not because people can write stupid things using any language that you can forbid them to use some ways of programming. IMHO, function forward declaration is such a thing : very useful in most of the cases, still theoricaly broken (as your example show), and this can be checked by the compiler. Nicolas Cannasse ------------------- 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