in reply to fixing Perl's inconsistencies
Actually I think += and especially -= should be modified. None of them makes much sense when used on a string, so they should behave this way:
my $string= "mirod"; $string += " is dumb"; # $string is now "mirod is dumb" $string -= "Sure "; # $string is now "Sure mirod is dumb"
Although I know this would start a religious war with those who want -= to behave like this:
$string="I am _not_ dumb"; $string -= "_not_ "; # now guess what's in $string?
I am ready to compromise and go for the second version only if >> and << are re-used too (after all who uses them on strings?) for my original proposal:
my $string= "can"; $string >> " compromise"; # $string is now "can compromise" $string << "I "; # $string is now "I can compromise"
As for <= of course it should do a deep copy of a reference while for consistency <- would do a shallow copy (just like = does).
|
|---|