I was I was babbling in #perl on irc.freenode.net about the perl design decision to not overload '.=' to work differently when operating on an array (pushing.) I feel this should work 'as I expect it to', and there is no reason to make this operator useless when the lhs is an array, or array ref. However, my opinions aside, Rindolf made a suggestion that should be the subject of meditation and might fit even more with the Perl ideology. ",=". It should be noted that such an operator wouldn't cause breakage with 5.10 because of its status in 5.8 -- nonexistent. It would be looked upon like //=, as sexy syntactic sugar.
Transcript as follows:
12:03 < EvanCarroll> eval: @_=[qw/foo bar baz/]; @_ .= 'bleh'; @_; 12:03 < buubot> EvanCarroll: Error: Can't modify array dereference in +concatenation (.) or string at eval line 1, at EOF 12:03 < EvanCarroll> didn't think so 12:03 < EvanCarroll> oh well back to pushing 12:03 < rindolf> EvanCarroll: maybe there should be a ,= 12:04 < rindolf> EvanCarroll: you can also try to overload an operator +. 12:04 < EvanCarroll> rindolf: wow, thats actually a good idea. 12:04 < EvanCarroll> rindolf: I won't overload it for myself; but ,= w +ould fit very elegantly into the perl arsenal of operators
Evan Carroll
www.EvanCarroll.com
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Should perl implement ,= or maybe overload .= (array context)
by theorbtwo (Prior) on Aug 23, 2006 at 17:41 UTC | |
by EvanCarroll (Chaplain) on Aug 23, 2006 at 18:47 UTC | |
by TimToady (Parson) on Aug 23, 2006 at 19:31 UTC | |
Re: Should perl implement ,= or maybe overload .= (array context)
by zshzn (Hermit) on Aug 24, 2006 at 05:19 UTC |
Back to
Meditations