At 11:50 AM -0700 9/23/02, Jonathan Sillito wrote: > > -----Original Message----- >> From: Piers Cawley [mailto:[EMAIL PROTECTED]] >> "Jonathan Sillito" <[EMAIL PROTECTED]> writes: >> > get_counter: >> > new_pad 1 >> >> Doesn't this violate the 'caller saves' principle, making it hard to >> do tail call optimization? Would it make sense to move the creation of >> a new pad into the Sub's invoke method? >> > >I am not sure how this violates the 'caller saves' principle, unless you >mean that the caller should be saving its own scratch pad if necessary? I >did notice that this is in pdd03: > >"The caller is responsible for preserving any environment it is >interested in keeping. This includes any and all registers, lexical >scoping and scratchpads, opcode libraries, and so forth." > >I suppose scratchpads could be an exception, to this?
I'd rather it not be, but there are issues with tail recursion and pads (amongst other things) anyway, since you're often several levels of pad deep at any one time. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk