Skip Menu |

This queue is for tickets about the Method-Signatures CPAN distribution.

Report information
The Basics
Id: 88962
Status: open
Priority: 0/
Queue: Method-Signatures

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Named arguments can obscure a positional argument called \%args.
Demonstration: use v5.14; use Method::Signatures; method xxx (\%args, Int :$y) { $args{x} + $y } say __PACKAGE__->xxx( {x => 40}, y => 2 ); Expected output: 42 Actual output: 2 This is caused by the fact that using any named parameters causes Method::Signatures to create a new lexical called %args which it uses to unpack named arguments from; this obscures the positional argument of the same name. My suggested solution would be to disallow any parameter named \%args.
Show quoted text
> My suggested solution would be to disallow any parameter named \%args.
I dunno ... that seems heavy-handed. Why just rename ours %_args or somesuch?
On 2013-09-25T19:20:57+01:00, BAREFOOT wrote: Show quoted text
> I dunno ... that seems heavy-handed. Why just rename ours %_args or > somesuch?
Because it's possible that there exist people who are already using Module::Signature's undocumented %args variable as a "feature".