Subject: | slurpy parameters accept default arguments |
$ cat bug/slurpy-default
#!perl
use Fun;
fun foo(@x = 42) {}
__END__
n$ perl -MO=Deparse bug/slurpy-default
use Fun;
sub foo {
do {
do {
my(@x) = @_
};
do {
@x = 42 if @_ <= 0
}
};
();
}
;
__DATA__
bug/slurpy-default syntax OK
OK, so (apart from the B::Deparse output being wrong about the scoping
of @x :-) it seems like you can specify default arguments for slurpy
parameters. Personally I think this should be a hard error because an
empty list is perfectly fine to assign to an array and there's no way to
distinguish between an empty list and an absent list, but at least the
behavior should be documented.