Perlists,

In Perl 5, lc, lcfirst, quotemeta, uc and ucfirst don't mutate.
chomp and chop do mutate.

I imagine these will all be methods in Perl 6:

    $foo.lc
    $foo.quotemeta
    $foo.chomp

I'd like a mutating version of lc, and a non-mutating version of chomp.
With some nice syntax, if possible.

If there isn't already such a thing in the making, I hereby suggest to
re-introduce C<.=>, to mean more or less the same as in Perl 5, but with
Perl 6's version of the C<.> operator.

In other words: C<$foo.lc> would not mutate and C<$foo.=lc> would.

    $foo += 5  ===>  $foo = $foo + 5
    $foo.=lc   ===>  $foo = $foo.lc

Makes sense to me.

Especially for C<sort> it would be nice for something like this:

    @foo.sort  # returns sorted copy

versus

    @foo.=sort  # sorts inline

I think this syntax reads better than Ruby's exclamation point
(foo.method!), because of the analogy with other mutating operators.

Please excuse me if this or something like this has already been taken
care of - I've searched for messages about it, but haven't found
anything.


Regards,

Juerd

Reply via email to