Continuation passing style and recursion limit

Austin Hastings Austin_Hastings at Yahoo.com
Thu Oct 1 18:08:27 UTC 2009


1. A recursion limit catches developer mistakes. If you write a bad 
program, eventually Parrot will say, "Dude. You've written a bad program."

2. Tailcall optimizations are something that the machine can do to try 
to fix up places where a tailcall *should* have occurred, but didn't. If 
the coder, or the HLL developer, generates code that looks like a sub 
call, then a continuation will be passed to the sub, telling it "come 
back here when you finish." And when that sub finishes, the next 
instruction @here would be "oh, okay, return using this continuation I 
have."  -Oc is an attempt to catch that mistake.
 
Keep in mind that Parrot is a virtual machine. Not a programming 
language. If somebody programming on the VM, or somebody implementing a 
language, makes a bad coding decision, it can still have bad results. 
Sometimes the machine can prevent those mistakes, or catch them early.

=Austin



Fishtank wrote:
> Hello,
> I read parrot uses CPS in its bytecode. If so why does it have a
> recursion limit and why does it have tail call optimizations via -Oc
>
> Thank you
> fishs
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>
>   



More information about the parrot-dev mailing list