Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Should perl implement ,= or maybe overload .= (array context)

by EvanCarroll (Chaplain)
on Aug 23, 2006 at 18:47 UTC ( #569165=note: print w/replies, xml ) Need Help??


in reply to Re: Should perl implement ,= or maybe overload .= (array context)
in thread Should perl implement ,= or maybe overload .= (array context)

I agree fully with the example on '+', and '.' operators and that's why I thought ,= was more consistent with perl philosophy; but favoring a function'al approach rather than an operator approach for arrays seems more consistent with PHP a la array_new. As a side note though the analogy doesn't hold entirely true, perl -e'print "4 foo"+"1"' will demonstrate a purpose for +'ing two strings.

I like '.=' more because it is clear what it should do in either context, and i don't really see a need for a ',='. Either operator would have a lower level of precedence too.



Evan Carroll
www.EvanCarroll.com
  • Comment on Re^2: Should perl implement ,= or maybe overload .= (array context)
  • Download Code

Replies are listed 'Best First'.
Re^3: Should perl implement ,= or maybe overload .= (array context)
by TimToady (Parson) on Aug 23, 2006 at 19:31 UTC
    We've debated adding ,= to Perl 6, but so far have decided it would too easy to confuse with the .= operator visually. I suppose we could add ,= just for completeness and then come back in six months and deprecate anyone who is using it. :-)

    As for unifying with the .= operator, that wouldn't work at all in Perl 6 because we've taken over dot for method calls, and .= already indicates that you want to turn a non-mutating method call into a mutating method call. The append operator in Perl 6 is the ~=, but in Perl 6 the ~ character has very strong implications of stringification, and we wouldn't want to break that.

    All that being said, it'd be trivial for you to add your own ,= operator to Perl 6, and that's probably where we should leave it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2021-10-23 05:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (86 votes). Check out past polls.

    Notices?