Leopold Toetsch <[EMAIL PROTECTED]> writes: > Piers Cawley <[EMAIL PROTECTED]> wrote: > >> I'm not sure you can optimize it to a jump opcode when you're tail >> calling another function can you? You could be tailcalling into a >> closure so you'll need to use invoke to do the right thing with the >> lexical stack etc. > > Argh, yes. What about: > > If the subroutine is constructed inside the sub, parrot sees the class > and can decide at compile time to either jump or invoke. > > If the subroutine is passed in, a runtime check could be done: > > if sub.isa("Sub") goto do_jump > invoke
Umm... not sure quite what you mean there. Don't forget that the sub could be got by doing: find_lex P0, 'sub_name'