On Mon, May 01, 2006 at 17:38:13 +0100, Dave Mitchell wrote: > One possible fix would be a COW scheme: when bless tries to bless a code > ref that happens to be an anon sub prototype, a new prototype is made and > stuck in the pad for future use. But that doesn't completely solve the > problem: any existing refs to the shared protoype will get to see the > blessed version of the sub. Why is there a distinction between prototype and non prototype? sub foo { sub { } }; my $sub = foo(); my $copy = foo(); aren't $sub and $copy different ref addrs? and don't they have 'bless' handled by simply copying the sub to a "normal" copy? traditionally the optimization is that if the copy count is 1 then this allocation can be written in place - this is more like shared constants. -- Yuval Kogman <nothingmuch@woobling.org> http://nothingmuch.woobling.org 0xEBD27418Thread Previous | Thread Next