On Wed, Jul 31, 2013 at 04:35:14PM -0700, Ricardo SIGNES via RT wrote: > What are the practical wins to making closure per-variable instead of per-environment? Not having to field about 10 new bug reports per week about leaks??? e.g. if we changed it, then in sub gen { my ($a,$b,$c) = ... intermediate calculations ...; my $x = something; return sub { $x }; } everyone would complain about how $a,$b,$c now leak. And that's a simple case; as things get more complex, the interrelationships between nested closures etc would mean nothing would ever end up getting freed, with everything tied back in a chain to the longest-lived element. Also in a typical Foo.pm file like package Foo; my ($a, $b, $c); Sub f1 { $a }; ... more lexicals ... ... more subs .... ... and so on for several 100 lines ... The subs would probably end up capturing every lexical declared within Foo, which would probably continue to exist until global destruction. -- print+qq&$}$"$/$s$,$a$d$g$s$@$.$q$,$:$.$q$^$,$@$a$~$;$.$q$m&if+map{m,^\d{0\,},,${$::{$'}}=chr($"+=$&||1)}q&10m22,42}6:17a2~2.3@3;^2dg3q/s"&=~m*\d\*.*gThread Previous | Thread Next