# New Ticket Created by Zoffix Znet # Please include the string: [perl #132302] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=132302 >
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(/(' '+)/ => {' ' ~ (' ' x ($0.chars - 1))}, /(\W)/ => {"&#{ord($0)};"}); say $/ <camelia> rakudo-moar de2b9ff72: OUTPUT: «"foo & bar"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