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

Owner: Nobody
Requestors: sam [at] linux.com
Cc:
AdminCc:

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



Subject: [BUG] Feed operators final sub / routine parens
To: rakudobug [...] perl.org
Date: Thu, 19 Jan 2017 20:34:56 +0900 (JST)
From: Sam Morrison <sam [...] linux.com>
Download (untitled) / with headers
text/plain 1.4k
The docs state the following regarding the feed operators: Show quoted text
> In the case of routines/methods that take a single argument or where the first argument is a block, it is often required that you call with parentheses (though this is not required for the very last routine/method).
https://docs.perl6.org/language/operators#index-entry-feed In the example, sort(), flat(), printf(), sprintf() can omit (): "my string" ==> sort "my string" ==> flat "my string" ==> printf "my string" ==> sprintf but fails with others (this isn't an exhaustive list): "my string" ==> say ===SORRY!=== Error while compiling: Unsupported use of bare "say"; in Perl 6 please use .say if you meant $_, or use an explicit invocant or argument, or use &say to refer to the function as a noun ------> "my string" ==> say⏏; "my string" ==> print ===SORRY!=== Error while compiling: Unsupported use of bare "print"; in Perl 6 please use .print if you meant $_, or use an explicit invocant or argument, or use &print to refer to the function as a noun ------> "my string" ==> print⏏; "my string" ==> reverse ===SORRY!=== Error while compiling: Unsupported use of bare "reverse"; in Perl 6 please use .reverse if you meant $_, or use an explicit invocant or argument, or use &reverse to refer to the function as a noun ------> "my string" ==> reverse⏏; This bug is similar to https://rt.perl.org/Ticket/Display.html?id=112396 Tested on 2016.12, v2016.12.113.gd.1.da.1.ba
CC: bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #130588] [BUG] Feed operators final sub / routine parens
To: perl6-compiler <perl6-compiler [...] perl.org>
Date: Thu, 19 Jan 2017 13:25:17 -0500
From: Brandon Allbery <allbery.b [...] gmail.com>
Download (untitled) / with headers
text/plain 960b

On Thu, Jan 19, 2017 at 6:43 AM, Sam M <perl6-bugs-followup@perl.org> wrote:
Show quoted text

"my string" ==> reverse
===SORRY!=== Error while compiling:
Unsupported use of bare "reverse"; in Perl 6 please use .reverse if you meant $_, or use an explicit invocant or argument, or use &reverse to refer to the function as a noun
------> "my string" ==> reverse⏏;

This bug is similar to https://rt.perl.org/Ticket/Display.html?id=112396

Actually, it's not; it's just the "catch common perl 5 idioms that don't do the same thing in perl 6" (specifically, reliance on $_ as default parameter) interacting oddly with a semantic perl 5 didn't have. Arguably there should be a way to suppress the p5-trap in that situation.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


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