Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Re: Re: Re: Thoughts on some new operators for perl (6 or 7)

by Juerd (Abbot)
on Mar 10, 2004 at 15:03 UTC ( #335461=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Thoughts on some new operators for perl (6 or 7)
in thread Thoughts on some new operators for perl (6 or 7)

If you want mutating on an object, than you should define method to work that way already.

No, that is exactly the opposite of what I want. That way you get again the mess that Perl 5 also has: some are mutating, some are not. I want everything to be non-mutating by default with some kind of modifier to make it mutating. This thread made me think of .= and I think it is a very good candidate, because it works much like the other op= operators: foo op= bar does the same as foo = foo op bar, but with possible optimizations.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


Comment on Re: Re: Re: Re: Re: Thoughts on some new operators for perl (6 or 7)
Select or Download Code
Re^5: Thoughts on some new operators for perl (6 or 7)
by hardburn (Abbot) on Mar 10, 2004 at 17:15 UTC

    In practice, you're not going to get that, unless you convince every Perl programmer to lay out their class design so they respect the mutating/non-mutating idiom.

    Also, is it your habit to downvote every node you happen to disagree with?

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

      In practice, you're not going to get that, unless you convince every Perl programmer to lay out their class design so they respect the mutating/non-mutating idiom.

      Not really. It'd be relatively simple to build in fallback support. That is: if there is no mutating variant, the non-mutating variant can be used with normal assignment and if there is no non-mutating variant, the mutating variant can be used with a temporary copy. The first thing happens in Perl 5 already with tied values: += is optimized for normal scalars, but for tied scalars separate FETCH and STORE calls take place.

      Also, is it your habit to downvote every node you happen to disagree with?

      No, only if the node is a proposal. Is it yours?

      Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

        No, only if the node is a proposal. Is it yours?

        It's just that every response of mine to you in this thread has been downvoted, which I find rather suspicious.

        ----
        : () { :|:& };:

        Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://335461]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2014-07-26 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls