* [Caml-list] The need for opcode GRAB?
@ 2002-11-15 9:15 A Joseph Koshy
2002-11-15 13:00 ` Dmitry Lomov
0 siblings, 1 reply; 5+ messages in thread
From: A Joseph Koshy @ 2002-11-15 9:15 UTC (permalink / raw)
To: Xavier Leroy; +Cc: caml-list
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?
Regards,
Koshy
<koshy@india.hp.com>
-------------------
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] The need for opcode GRAB?
2002-11-15 9:15 [Caml-list] The need for opcode GRAB? A Joseph Koshy
@ 2002-11-15 13:00 ` Dmitry Lomov
2002-11-15 19:24 ` Blair Zajac
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Lomov @ 2002-11-15 13:00 UTC (permalink / raw)
To: A Joseph Koshy, Xavier Leroy; +Cc: caml-list
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?)
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] The need for opcode GRAB?
2002-11-15 13:00 ` Dmitry Lomov
@ 2002-11-15 19:24 ` Blair Zajac
2002-11-16 0:18 ` Alan Schmitt
0 siblings, 1 reply; 5+ messages in thread
From: Blair Zajac @ 2002-11-15 19:24 UTC (permalink / raw)
To: dsl; +Cc: A Joseph Koshy, Xavier Leroy, caml-list
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] The need for opcode GRAB?
2002-11-15 19:24 ` Blair Zajac
@ 2002-11-16 0:18 ` Alan Schmitt
2002-11-18 8:29 ` Dmitry Lomov
0 siblings, 1 reply; 5+ messages in thread
From: Alan Schmitt @ 2002-11-16 0:18 UTC (permalink / raw)
To: caml-list
* Blair Zajac (blair@orcaware.com) wrote:
> What is the grab/restart trick? Is there a URL to an explanation?
>
> I didn't find anything definitive through Google.
>
> Best,
> Blair
A long time ago, in a research building far far away, Didier Le Botlan
and me started a small project to explain how ocaml worked, under the
hood. We haven't done anything about for a long time, and it's barely
started but if you want to have a look, here are the html pages:
http://pauillac.inria.fr/~lebotlan/docaml_eng.html
And if anyone wants to contribute, I'd be glad to restart the project.
The sourceforge project page is at:
http://www.sf.net/projects/docaml/
Alan
--
The hacker: someone who figured things out and made something cool happen.
-------------------
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] The need for opcode GRAB?
2002-11-16 0:18 ` Alan Schmitt
@ 2002-11-18 8:29 ` Dmitry Lomov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Lomov @ 2002-11-18 8:29 UTC (permalink / raw)
To: Alan Schmitt, caml-list
On Saturday 16 November 2002 03:18, Alan Schmitt wrote:
> A long time ago, in a research building far far away, Didier Le Botlan
> and me started a small project to explain how ocaml worked, under the
> hood. We haven't done anything about for a long time, and it's barely
> started but if you want to have a look, here are the html pages:
> http://pauillac.inria.fr/~lebotlan/docaml_eng.html
>
> And if anyone wants to contribute, I'd be glad to restart the project.
> The sourceforge project page is at:
> http://www.sf.net/projects/docaml/
I guess this would be a very cool resource, but I am afraid I have
enough trouble documenting my own work to start doing this for others :)
Probably Xavier could give a helping hand? ;)
I can try to ask some of my students to TeXize (and translate to English)
their notes, but I do not think they'll agree (I wouldn't :))
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-11-18 8:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-15 9:15 [Caml-list] The need for opcode GRAB? A Joseph Koshy
2002-11-15 13:00 ` Dmitry Lomov
2002-11-15 19:24 ` Blair Zajac
2002-11-16 0:18 ` Alan Schmitt
2002-11-18 8:29 ` Dmitry Lomov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox