|To:||"rakudobug [...] perl.org" <rakudobug [...] perl.org>|
|Subject:||.trans different behavior for Str Pairs versus List Pairs|
|Date:||Fri, 02 Sep 2016 02:59:22 +0000|
|From:||Sterling Hanenkamp <sterling [...] hanenkamp.com>|
From #perl6 today:
21:42:01 <zostay> m: say "test.foo".trans('.' => '::');
21:42:01 <+camelia> rakudo-moar d2b115: OUTPUT«test:foo␤»
21:42:11 <zostay> m: say "test.foo".trans(['.'] => ['::']);
21:42:12 <+camelia> rakudo-moar d2b115: OUTPUT«test::foo␤»
21:42:16 <zostay> that seems like a bug
This appears to be documented as a feature in the spec tests, but is not really documented on docs.perl6.org.
Assuming my quick read of the spec is correct, I propose either of the following solutions, with the first getting my vote:
1. Change the spec and make the behavior between the two calling styles consistent so I don't have to remember this bit minutia about a subroutine I use every once in a long while.
2. Fix the documentation on docs.perl6.org AND modify the Str => Str variety of .trans so that any attempt to use multiple chars results in a warning or you risk getting this bug report again by others in the future.