-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
META_REDUCE_RIGHT doesn't check for 1-arg case like META_REDUCE_LEFT #1705
Comments
Honestly this feels more like the
Is it really more polite to just pretend that |
This aligns the behavior of `META_REDUCE_RIGHT` to that of `META_REDUCE_LEFT` when handling 1-arg cases: > sub infix:<@> ($a, $b) is assoc<left> { [$a, $b] } > say [@] 10 10 > sub infix:<@> ($a, $b) is assoc<right> { [$a, $b] } > say [@] 10 10 This addresses R#1705 (#1705).
This aligns the behavior of `META_REDUCE_RIGHT` to that of `META_REDUCE_LEFT` when handling 1-arg cases: > sub infix:<@> ($a, $b) is assoc<left> { [$a, $b] } > say [@] 10 10 > sub infix:<@> ($a, $b) is assoc<right> { [$a, $b] } > say [@] 10 10 This addresses R#1705 (#1705).
I'm with @ab5tract on this one. I think METAOP_REDUCE_LEFT's magical handling is counter productive here. If you remove it, all the sensible cases still work, i.e. Any new operator should do the same. Guessing that identity will always be just the input value would lead to WAT situations like the examples posted in this issue demonstrate. Adding a |
From IRC: https://irclog.perlgeek.de/perl6/2018-04-07#i_16017645
Also does
METAOP_REDUCE_CHAIN
need something too? There's no 1-arg case for&infix:<(elem)>
yet the 1-arg case returnsTrue
. Seems to make sense, but that supposed to be like that?The text was updated successfully, but these errors were encountered: