raptor writes: : I was just reading this : : : http://www.javalobby.com/clr.html : : and a question raised to me. Will Parrot have some optimisation : (features) that will speed up closures & continuation ?
Well, we understand closures pretty well already, since Perl 5 has 'em. Most of the optimizations there are what you'd like to do for any subroutine call. There just happen to be references back to lexicals outside your current scope, so it really depends a lot on whether your GC model is efficient. Continuations are more problematical, because they essentially have references to their entire dynamic context, including the call stack. But we'll need something like continuations if we're to generalize pattern matching outside of regular expressions. The current regex engine does backtracking by recursing deeper when you think you're returning from a nested () construct. The more general alternative is to "fork" the call stack. One obvious optimization there is to do a virtual fork using copy-on-write semantics. I suspect COW is going to be important in Perl 6 on other grounds as well, whenever we want to preserve the appearance of value passing when we're actually doing reference passing. Larry