On Fri, Jul 01, 2005 at 07:12:40PM +0100, Nicholas Clark wrote: : Does this mean that to remove recursion from perl 5, : instead of re-writing the engine to be iterative, it might be easier to : emulate co-routines using setjmp/longjmp, retaining almost all of the existing : code?
Easier, yes. More efficient--probably not, depending on the architecture. Of course, if we slow down Perl 5 enough it'll encourage people to migrate. Hopefully to Perl 6, but that's not guaranteed. :-) And it might not be easier if your setjmp/longjmp clobbers the wrong registers. It's been a while since I've played with setjmp/longjmp, but my recollection of the docs tells me that you basically can't trust your registers after a longjmp. Possibly a smattering of volatile declarations fixes that, along with slowing the code down. Dunno. Larry