On Mon, Mar 27, 2006 at 02:54:05PM -0600, Jonathan Scott Duff wrote: : On Mon, Mar 27, 2006 at 10:46:02PM +0200, Yuval Kogman wrote: : > On Mon, Mar 27, 2006 at 14:35:52 -0600, Jonathan Scott Duff wrote: : > > I think that if C<temp> is the new C<local>, then immediately after the : > > C<temp $x> line, $x should hold whatever flavor of undef is appropriate. : > <snip>> : > > Is there some reason we're huffmannizing : > <snip> : > : > Because 90% of the code that people use local for in perl 5 is for : > counting levels and automatically unwrapping them. The other 10% are : > for more complex values. : : Make me believe your 90/10 numbers.
Doesn't matter what the numbers are, it's the right thing to do. The default undef hack stems from the days when local() was trying to fill the role of my() as well. Nowadays temp() should just mean: "Please arrange to restore yourself to your current value" and nothing more. (Well, plus the notion that, when applied to a mutator, the save/restore instruction is passed on to the mutatee to save itself before the mutation, not after.) The p5-to-p6 translator will turn local $x; into temp undefine $x; Larry