Skip Menu |
Report information
Id: 132302
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: Str.trans grabs callers $/ for unknown reason
Download (untitled) / with headers
text/plain 1.6k
IRC: https://irclog.perlgeek.de/perl6-dev/2017-10-14#i_15302654 1) Spotted that Str.trans grabs caller's $/ with $/ := nqp::getlexcaller('$/') The same is not done for Cool.trans candidate, so presumably that makes whatever feature needs caller's $/ broken for Cool, while working for Str. However... 2) Why does Str.trans grabs caller's $/ in the first place? The commit that added it seems to claim to fix something that isn't meant to work as tr/// replaces per char and doesn't use special regex syntax (basically, author of the commit seems to be confusing it with s///). So I tried removing all of the $/ business from Str.trans, but that caused 2 tests to fail, one of which does something like this: <Zoffix__> m: say '"foo & bar"'.trans(/(' '+)/ => {' ' ~ ('&nbsp;' x ($0.chars - 1))}, /(\W)/ => {"&#{ord($0)};"}); say $/ <camelia> rakudo-moar de2b9ff72: OUTPUT: «&#34;foo &nbsp;&#38; &nbsp;&nbsp;bar&#34;␤Nil␤» As can be seen from the eval above, while the $/ is used internally for trans stuff, the trans's caller's $/ is not set to anything. So unless I'm misunderstanding something, at least the part in Str.trans's proto that grabs caller's $/ and possibly some other occurrences inside Str.trance need to be removed as they're useless wasted cycles. However, if there *is* some reason for why Str.trans proto (and routine) grab caller's $/, the same thing needs to be added to Cool.trans, to make it work right too. [1] https://github.com/rakudo/rakudo/commit/ec79843830588c0ef941e79ea4bab5bce05122f9 [2] https://gist.github.com/zoffixznet/56ee3544201dbd18a419514ed70a782e
From: Brandon Allbery <allbery.b [...] gmail.com>
Subject: Re: [perl #132302] Str.trans grabs callers $/ for unknown reason
Date: Sat, 14 Oct 2017 14:03:24 -0400
CC: bugs-bitbucket [...] rt.perl.org
To: perl6-compiler <perl6-compiler [...] perl.org>
Download (untitled) / with headers
text/plain 664b
On Sat, Oct 14, 2017 at 1:15 PM, Zoffix Znet <perl6-bugs-followup@perl.org> wrote:
Show quoted text
2) Why does Str.trans grabs caller's $/ in the first place? The commit that added
   it seems to claim to fix something that isn't meant to work as tr/// replaces per
   char and doesn't use special regex syntax (basically, author of the commit seems
   to be confusing it with s///).

Are you sure this isn't just a copypasto?

--
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