Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
isomorphic
· 11y ago · 0 comments
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.
Comments
[–]
BingsF
11y ago
++ and -- (both versions of each) would end up being method calls as well in Ruby or Python. They're even overridable in C++.
[–]
odonnellryan
11y ago
Yes, this exactly! While rarely a good idea, it does give you super powers when dealing with specialized libraries, or when writing your own :)
[–]
paulddraper
11y ago
Have you ever written a container (with an iterator)?
[–]
akira2501
11y ago
And yet, ruby still provides 4 unary operators that can be redefined.