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
Parameter '' requires an instance, LTA error #3187
Comments
From @zhuomingliangJimmyZ> r: sub f(Int $x where $x > 0) { say "yup" }; my Int $a; f($a); The above is missing '$x'. Timotimo> r: sub f(Int:D $x) { say "yup" }; my Int $a; f($a); Jimmy Zhuo |
From @usev6The error message has changed slightly and now states that "Invocant requires an instance". $ perl6 -e 'sub f(Int $x where $x > 0) { say "yup" }; my Int $a; f($a);' Formerly the message said "Parameter '' requires an instance" (and the whole bug report is about the missing parameter name $x within this message). IMHO the current error message is good -- even without speaking about $x. So, is this closeable? |
1 similar comment
From @usev6The error message has changed slightly and now states that "Invocant requires an instance". $ perl6 -e 'sub f(Int $x where $x > 0) { say "yup" }; my Int $a; f($a);' Formerly the message said "Parameter '' requires an instance" (and the whole bug report is about the missing parameter name $x within this message). IMHO the current error message is good -- even without speaking about $x. So, is this closeable? |
@usev6 - Status changed from 'new' to 'open' |
From @perlpilotIMHO, the message is actually slightly worse. Now it's talking about an -Scott On Wed, Mar 11, 2015 at 1:26 PM, Christian Bartolomaeus via RT <
|
From @skidsFWIW there are two layers to this ticket: failure on operators, and The error is due to a failure during evaluation the where clause $ perl6 -e 'my Int $x; my $f = $x > 0;' ... The "invocant" is because the '>' operator is finding its candidate $ perl6 -e 'sub b (Str $a) { }; sub f(Int $x where { b(3) } ) { say "yup" }; my Int $a; f($a);' ...but it has to be done with care for optimizability and could be messy As a sidenote, it is not very idiomatic to repeat the parameter name in the sub f(Int $x where * > 0) ...and FWIW using Int:D would yield: $ perl6 -e 'sub f(Int:D $x where * > 0) { say "yup" }; my Int $a; f($a);' But whether failures that occur during a runtime constraint check should |
Migrated from rt.perl.org#118865 (status was 'open')
Searchable as RT118865$
The text was updated successfully, but these errors were encountered: