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 RAA15346; Wed, 7 Apr 2004 17:11:18 +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 RAA15193 for ; Wed, 7 Apr 2004 17:11:17 +0200 (MET DST) Received: from host1.stonesfair.com (host1.stonesfair.com [208.184.191.145]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i37FC8jq020965 for ; Wed, 7 Apr 2004 17:12:09 +0200 Received: from mev (63-217-154-71.greystoneapts.com [63.217.154.71]) by host1.stonesfair.com (8.12.8/8.12.8) with ESMTP id i37EsEdP014533 for ; Wed, 7 Apr 2004 07:54:15 -0700 Received: from ijtrotts by mev with local (Exim 3.35 #1 (Debian)) id 16M9gK-0000iS-00 for ; Thu, 03 Jan 2002 07:21:24 -0800 Date: Thu, 3 Jan 2002 07:21:24 -0800 To: caml-list@inria.fr Subject: Re: [Caml-list] Function forward declaration? Message-ID: <20020103152124.GA2723@mev> Mail-Followup-To: ijtrotts@ucdavis.edu, caml-list@inria.fr References: <60532B15DF92FD4693AA89B2F7E01D8F013F29EC@tmex02> <00cf01c41bd6$391b53a0$0203a8c0@hoedic> <20040406175320.GA19840@redhat.com> <1081279717.16531.6.camel@qrnik> <002901c41c65$b53e4c50$19b0e152@warp> <1081345936.19232.579.camel@pelican> <20040407141519.GA6618@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040407141519.GA6618@redhat.com> User-Agent: Mutt/1.3.28i From: Issac Trotts 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 issac:01 trotts:01 ijtrotts:01 2004:99 2004:99 val:01 val:01 'return':99 issac:01 trotts:01 compiler:01 compiler:01 ocaml:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 92 On Wed, Apr 07, 2004 at 03:15:19PM +0100, Richard Jones wrote: > On Wed, Apr 07, 2004 at 11:52:17PM +1000, skaller wrote: > > IMHO it isn't forward calling that is broken, > > but global variables. > > A somewhat controversial viewpoint ... While minimising the use of > global variables might be a theoretical desirable goal, they are very > useful when you're actually writing real programs under the schedule > pressure for real users.. > > > > and this can be checked by the compiler. > > > > How? *** > > > > What do you suggest if the compiler > > is not sure if a variable is initialised or not? > > Java bans, Felix allows, Ocaml forces the programmer > > to hack. > > The trouble seems to be that I have a perfectly practical and > reasonable desire to see prototypes added to the language, because, > believe it or now, it helps to solve some problems in the Real World. > Now if there's some deep reason why it's actually impossible I would > understand, but plenty of other languages (eg. C) seem to have > prototypes and they get along just fine. How about this: # let f g x = g x (* Pass the function g as an argument. *) let g x = x*x (* or whatever. *) let f = f g (* Define a fresh f in terms of g and the old f. *) ;; val g : int -> int = val f : int -> int = # f 3;; - : int = 9 > (Same, by the way, goes for a 'return' statement which OCaml is crying > out for). If you're looking for clarity, you can use the comment (* return *). If it's for flow control, you can raise an exception. Issac Trotts ------------------- 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