News for hackers. Stuff that matters.
Re:Remove the ++ and –- operators by isomorphic on Thursday December 03, 2015 @04:16PM (#10672699)
I think forcing me to use "+=" in Ruby reminds me that it's really a method call (which can be overridden), rather than an increment operation on primitive types.
Re:Remove the ++ and –- operators by BingsF on Thursday December 03, 2015 @08:48PM (#10674091)
++ and -- (both versions of each) would end up being method calls as well in Ruby or Python. They're even overridable in C++.
Re:Remove the ++ and –- operators by odonnellryan on Thursday December 03, 2015 @04:37PM (#10672847)
Yes, this exactly! While rarely a good idea, it does give you super powers when dealing with specialized libraries, or when writing your own :)
Re:Remove the ++ and –- operators by paulddraper on Friday December 04, 2015 @09:41AM (#10676536)
Have you ever written a container (with an iterator)?
Re:Remove the ++ and –- operators by akira2501 on Thursday December 03, 2015 @07:03PM (#10673691)
And yet, ruby still provides 4 unary operators that can be redefined.