Perl 6:音译中的反斜杠(tr ///)

Jo *_*ing 14 transliteration perl6

我在试验时注意到tr///,它似乎没有转换反斜杠,即使在转义时也是如此.例如,

say TR"\^/v"." given 'v^/\\';
say TR"\\^/v"." given 'v^/\\';
say TR"\ ^/v"." given 'v^/\\';
Run Code Online (Sandbox Code Playgroud)

所有这些都是输出 ...\而不是我的预期,....

还有一些其他奇怪的行为,比如\看似只是转义小写字母,但是文档页面没有太多信息...... \在音译(tr///)中反斜杠()的行为究竟是什么?

don*_*ldh 6

有一个错误是由反斜杠被吞下而不是正确地转义为tr ///的语法中的东西.

say TR/\\// given '\\'
===SORRY!=== Error while compiling:
Malformed replacement part; couldn't find final /
at line 2
------> <BOL>?<EOL>
Run Code Online (Sandbox Code Playgroud)

我已经提出了https://github.com/rakudo/rakudo/issues/2456并提交了https://github.com/rakudo/rakudo/pull/2457修复它.

答案的第二部分是Perl 6试图挺难的一些报价构造仅仅解释\为有效的转义序列,即逃生\n,\r,\s,\',等,否则它被保留为文字\.