Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The invocant is not an argument. #16

Open
schwern opened this issue Feb 22, 2015 · 0 comments
Open

The invocant is not an argument. #16

schwern opened this issue Feb 22, 2015 · 0 comments

Comments

@schwern
Copy link
Contributor

schwern commented Feb 22, 2015

$ perl -wle 'use Function::Parameters qw(:strict);  method foo($bar) {}  main->foo()'
Too few arguments for method foo (expected 2, got 1) at -e line 1.
    main::foo("main") called at -e line 1

I would expect that to say "expected 1, got 0".

From the caller's point of view, the invocant is not an argument. If you asked someone how many arguments are being passed to $obj->method(1, 2, 3) they'd say three, not four. That Perl methods put the invocant on the argument stack is an odd quirk of Perl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant