Skip Menu |
Report information
Id: 131932
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Inconsistency: `&infix:<^^>` evaluates Callables, but regular `^^` doesn't
Download (untitled) / with headers
text/plain 481b
The first example below evaluates the code block, while the two examples after it never do and return the block raw. Is this by design? <Zoffix_> m: &infix:<^^>(1, -> {say 2}) <camelia> rakudo-moar 2545e6: OUTPUT: «2␤» <Zoffix_> m: 1 ^^ -> {say 2} <camelia> rakudo-moar 2545e6: ( no output ) <Zoffix_> m: 0 ^^ -> {say 2} <camelia> rakudo-moar 2545e6: ( no output ) Show quoted text
Zoffix_> m: say (0 ^^ -> {say 2})
<camelia> rakudo-moar 2545e6: OUTPUT: «-> { #`(Block|72040712) ... }␤»
Download (untitled) / with headers
text/plain 694b
It's the same with && and ||: ➜ &infix:<&&>(1, -> {say 2}); # 2 ➜ say 1 && -> {say 2}; # -> { #`(Block|169403552312) ... } ➜ &infix:<||>(0, -> {say 2}); # 2 ➜ say 0 || -> {say 2}; # -> { #`(Block|786414142008) ... } And also with the loose-precedence versions `and`, `or`, `xor`. And also with `xx`: ➜ &infix:<xx>(-> {say 2}, 2) 2 2 ➜ say -> {say 2} xx 2 (-> { #`(Block|315591575136) ... } -> { #`(Block|315591575208) ... }) I.e., it's apparently a general rule for "thunky" operators. Whether it's intentional, I don't know. The design docs don't mention it: https://design.perl6.org/S03#Tight_and_precedence


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org