Subject: | generated code "leaks" into return value of empty-body subs |
#!perl
use signatures;
sub empty ($x)
{
}
print empty("A", "B"), "\n"; # list context
print scalar empty("A", "B"), "\n"; # scalar context
__END__
$ perl leak.pl
A
2
I think 'empty' should return the empty list in list context and undef
in scalar context, just as if it was 'sub empty {}'. I know where the
values are coming from, but I think this is an implementation detail
(that should not be exposed to the user) leaking through the abstraction.