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
proto signature default values don't work (NYI?) #4665
Comments
From @LLFournThe design docs don't specifically say it's meant to work but implies it by class A { A.foo(); #!> none of these signatures match If specifying a default in a proto is wrong it should carp I guess. |
From @lizmat¢
Looks like the { * } is overriding anything you’re specified in the signature. Putting anything else in there, does seem to do the right thing. But there is no easy way to dispatch to the other candidate (that I know of).
Perl 6 doesn’t carp (afaik): but yeah, it should fail :-) Liz |
The RT System itself - Status changed from 'new' to 'open' |
From @LLFournlizmat++ I don't totally get the concept of { * } so I won't comment whether class A { proto method foo(Int() $x) {*} $x.WHAT.say; #-> Str } A.foo('1'); On Wed, Oct 21, 2015 at 11:31 PM, Elizabeth Mattijsen <liz@dijkmat.nl>
|
From @jnthnOn Wed Oct 21 06:34:47 2015, lloyd.fourn@gmail.com wrote:
I wouldn't expect it, nor defaults, to do so; the multis are still subs with their own signatures. Further, we rely on the ability to not have to really call an onlystar proto at all for optimization, and since all operators are multi-dispatch, that's important. Arguably, the use of certain features in an onlystar proto could add a note to the "potential difficulties", since it's very likely a thinko. /jnthn |
From @LLFournWelcome back jnthn :) That makes sense. I thought that proto was a magic way to set defaults for perl6 -e 'proto sub test(Str $x){*}; multi sub test($x) { $x.say }; fails. But it looks like proto is only there to check args, it can't change Agree re helping out others with the same misunderstanding with a warning. On Wed, Oct 28, 2015 at 12:18 AM, jnthn@jnthn.net via RT <
|
Migrated from rt.perl.org#126417 (status was 'open')
Searchable as RT126417$
The text was updated successfully, but these errors were encountered: