Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] The need for opcode GRAB?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Blair Zajac <blair@o...>
Subject: Re: [Caml-list] The need for opcode GRAB?
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 <blair@orcaware.com>
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