Re: RFC 170 (v1) Generalize =~ to a special-purpose assignment operator

[email protected] (Nathan Wiger)
Newsgroups perl.perl6.language.regex
Message-ID <[email protected]>
> This RFC proposes a simple use for C<=~>: as a last-argument rvalue
> duplicator. What this means is that an expression such as this:
> 
>    $value = dostuff($arg1, $arg2, $value);
> 
> Could now be rewritten as:
> 
>    $value =~ dostuff($arg1, $arg2);

David Nicol and I were brainstorming offline, and came up with a cool
extension: ~=. These new operator would do a similar thing to =~ as
described by the RFC, only LEFT padding the args:

    $stuff =~ dojunk(@args);   # $stuff = dojunk(@args, $stuff);
    $stuff ~= dojunk(@args);   # $stuff = dojunk($stuff, @args);

The position of the ~ tells you how args are filled in: if it's on the
left, then they're filled in to the left. If they're on the right, then
they're filled in to the right. Quite flexible, IMO.

-Nate
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.