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
multi built-ins are not assignable to Callable #1566
Comments
|
I created my own pure multi sub in a module and exported it and it did not suffer from the same issue. Despite identifying as a unit module Mux;
proto sub mux(|) is pure is export {*}
multi sub mux(+args, :&by!) { args.max(&by) }
multi sub mux(+args) { args.max } ... elsewhere use lib 'lib';
use Mux;
say &mux.WHAT; # OUTPUT: (Sub+{is-pure})
my &func = &mux;
say func([3, 5, 2]); # OUTPUT: 5 |
|
Blocker label added to make sure we do something about this before the release. |
|
The title of the Issue is inaccurate, you can assign core multies: The issue looks to be the same as RT#128905. Seems 55bc053 made |
|
Found that composing affected types fixes the issue: and Perl6::Metamodel::Mixins.mixin (that traits, like So I guess the work-around doesn't work-around perfectly. |
|
FWIW, I believe the underlying issue (aka golf) is: |
|
I tried fixing this by moving |
|
Started on a promising endeavor of moving all subs into a place past all Callable types in the setting: 3506395576 ...but we have traits on a bunch of methods too and dealing with those is trickier. I started adding I've no real idea of what |
Removes blocker status from R#1566 #1566 The actual bug is that Callable role gets mixed in into routines before it's composed, and when it is composed, the routines end up not "doing" `Callable` role, even though they do. There are many more routines suffering this issue, but these three regressed since last release and we don't have the time to fix the primary bug before the release, so in this fudge goes.
R#1566: rakudo/rakudo#1566 Rakudo workaround for select routines: rakudo/rakudo@4513c279d4
|
We didn't have the time to fix this before the release. Since conditions that cause the bug are known (mixing in a role into For those three, I added a workaround and tests covering them, so this ticket is no longer a release blocker, but the bug still needs to be fixed and more thoroughly tested. |
|
Heh. Well, time flew by, eh? Reading the logs, |
|
Have found some more fallout from the multi-fication of subs. Additional context It seems the proto sig Current workaround is to force a single value, eg. A possible quick-fix might be to introduce a another multi, ie. multi sub lc(Cool $a, Cool $b) {
$a.lc cmp $b.lc
} |
|
Ah, that's an entirely different issue from OP. I filed it here: #1739 |
|
Fixed with 7f2ae26. |
The Problem
When assigning a built-in function (eg.
max) to a Callable, Rakudo complains that it "expected Callable but got Sub+{is-pure}"Expected Behavior
Actual Behavior
Since
maxand other built-ins were turned into multi's (eg. 55bc053) trying to do either of the above yields the following runtime errorThe text was updated successfully, but these errors were encountered: