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 UAA25802; Fri, 15 Nov 2002 20:28:21 +0100 (MET) 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 UAA25835 for ; Fri, 15 Nov 2002 20:28:19 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from orcaware.com (bdsl.66.12.233.174.gte.net [66.12.233.174]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gAFJSH110507; Fri, 15 Nov 2002 20:28:17 +0100 (MET) Received: from orcaware.com (localhost.localdomain [127.0.0.1]) by orcaware.com (8.12.5/8.12.5) with ESMTP id gAFJO3Eh006920; Fri, 15 Nov 2002 11:24:09 -0800 Message-ID: <3DD549E5.4B538DD9@orcaware.com> Date: Fri, 15 Nov 2002 11:24:21 -0800 From: Blair Zajac X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en,x-ns1rfacHe4WNh5,x-ns2U100btwUq5f MIME-Version: 1.0 To: dsl@intellij.com CC: A Joseph Koshy , Xavier Leroy , caml-list@inria.fr Subject: Re: [Caml-list] The need for opcode GRAB? References: <200211150915.OAA10510@postbox.india.hp.com> <200211151600.31088.dsl@intellij.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Dmitry Lomov wrote: > > On Friday 15 November 2002 12:15, A Joseph Koshy wrote: > > Perhaps a basic question about the O'Caml bytecode interpreter: > > > > Why do we need to check at runtime if a function is being > > partially applied? Isn't this information available to the > > compiler? > > No it is not: > > implementation A.ml: > let f x y = x + y > let g x = if x = 1 then fun y -> y else fun y -> y - 1 > > interface A.mli: > val f : int -> int -> int > val g : int -> int -> int > > usage (somewhere outside A): > let k = (A.f 1) (* this application is partial *) > let r = (A.g 1) (* this application is not partial *) > > Compiler cannot distinguish between those two cases > (knowing only A interface). > > BTW a GRAB/RESTART trick is very cool IMHO. > My students always "Wow!" at it. Any references as to > where it comes from (or was it a Xavier's own clever idea?) What is the grab/restart trick? Is there a URL to an explanation? I didn't find anything definitive through Google. Best, Blair -- Blair Zajac Web and OS performance plots - http://www.orcaware.com/orca/ ------------------- 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