Closed p5pRT closed 11 years ago
[1a] perl could give a warning\, e.g. "Useless use of transliteration (tr///) in void context"\, for the following: perl -we '$_ = "1x32141x98234"; tr/x//' perl -we 'my $x = "1x32141x98234"; $x =~ tr/x//' and
[1b] (somewhat harder and probably not as useful) perl -we '$_ = "1x32141x98234"; tr/a-z/a-def-z//' perl -we 'my $x = "1x32141x98234"; $x =~ tr/a-z/a-def-z/'
[2a] perl could give a warning\, e.g. "Useless use of /d in transliteration (tr///)"\, for the following: perl -we 'my $x = "1x32141x98234"; $x =~ tr/x//d' (which then becomes case [1a]) and
After the /d is known to be useless it could allow perl -we '"1x32141x98234" =~ tr/x//d'
[2b] (somewhat harder and probably not as useful) perl -we 'my $x = "1x32141x98234"; $x =~ tr/a-z/l-za-m/d' The tr is useful but the /d isn't.
[2a] perl could give a warning\, e.g. "Useless use of /d in transliteration (tr///)"\, for the following: perl -we 'my $x = "1x32141x98234"; $x =~ tr/x//d'
How is that a useless use of /d?
(which then becomes case [1a]) and
After the /d is known to be useless it could allow perl -we '"1x32141x98234" =~ tr/x//d'
[2b] (somewhat harder and probably not as useful) perl -we 'my $x = "1x32141x98234"; $x =~ tr/a-z/l-za-m/d' The tr is useful but the /d isn't.
That's probably not very hard at all; simply count the number of characters in each class\, and if they're the same\, the /d is useless.
There could also be a warning when the left side includes more characters than the right side.
Of course\, adding these warnings would probably affect a fair amount of existing code.
Ronald
You are correct. I though tr/x//d would be equivalent to tr/x/x/d. I missed this
If the "/d" modifier is used\, the REPLACEMENTLIST is always interpreted exactly as specified.
Sorry. The rest of my bug report is probably not important enough to bother with.
I don't know if these new warnings are wanted\, but attached is a patch that adds the new warnings\, tests and entries in perldiag.pod...
On Mon Nov 17 06:13:52 2008\, reneeb wrote:
I don't know if these new warnings are wanted\, but attached is a patch that adds the new warnings\, tests and entries in perldiag.pod...
Can anyone comment on the request for addition of two more warnings in the patch attached?
Thank you very much. Jim Keenan
On Fri Apr 20 18:28:01 2012\, jkeenan wrote:
On Mon Nov 17 06:13:52 2008\, reneeb wrote:
I don't know if these new warnings are wanted\, but attached is a patch that adds the new warnings\, tests and entries in perldiag.pod...
Can anyone comment on the request for addition of two more warnings in the patch attached?
I donât think these warnings are really necessary. They will be more of an annoyance than a help. But most code is unlikely to run into them\, so I wonât quibble over it if someone else really wants them in.
--
Father Chrysostomos
On Fri Apr 20 22:16:29 2012\, sprout wrote:
On Fri Apr 20 18:28:01 2012\, jkeenan wrote:
On Mon Nov 17 06:13:52 2008\, reneeb wrote:
I don't know if these new warnings are wanted\, but attached is a patch that adds the new warnings\, tests and entries in perldiag.pod...
Can anyone comment on the request for addition of two more warnings in the patch attached?
I donât think these warnings are really necessary. They will be more of an annoyance than a help. But most code is unlikely to run into them\, so I wonât quibble over it if someone else really wants them in.
In ten months\, no one has seconded the motion to apply the patch. Hence\, I'm going to conclude that it should not be applied and am closing this ticket.
Thank you very much. Jim Keenan
@jkeenan - Status changed from 'open' to 'rejected'
Migrated from rt.perl.org#7911 (status was 'rejected')
Searchable as RT7911$