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 OAA08792; Fri, 15 Nov 2002 14:03:33 +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 OAA08849 for ; Fri, 15 Nov 2002 14:03:32 +0100 (MET) Received: from is.intellij.net ([213.182.181.98]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id gAFD3U101364 for ; Fri, 15 Nov 2002 14:03:31 +0100 (MET) Received: (qmail 28636 invoked by uid 89); 15 Nov 2002 13:02:15 -0000 Received: from dsl-ps.labs.intellij.net (192.168.1.25) by is.intellij.net with SMTP; 15 Nov 2002 13:02:14 -0000 Content-Type: text/plain; charset="iso-8859-1" From: Dmitry Lomov Reply-To: dsl@intellij.com Organization: IntelliJ Labs To: A Joseph Koshy , Xavier Leroy Subject: Re: [Caml-list] The need for opcode GRAB? Date: Fri, 15 Nov 2002 16:00:31 +0300 User-Agent: KMail/1.4.1 Cc: caml-list@inria.fr References: <200211150915.OAA10510@postbox.india.hp.com> In-Reply-To: <200211150915.OAA10510@postbox.india.hp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200211151600.31088.dsl@intellij.com> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 =3D x + y let g x =3D if x =3D 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 =3D (A.f 1) (* this application is partial *) let r =3D (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?) Cheers, Dmitry ------------------- 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