Live data from Hacker News

Remove the ++ and –- operators

github.com

1–10 of 249 posts

Re: Remove the ++ and –- operators

#3

> Their expressive advantage is minimal - x++ is not much shorter than x += 1 Personal opinion, but I definitely miss '++' every time I'm doing '+=' in Python.

I think I'd argue with the "not much shorter" because it's less typing to perform a `++` versus `+=1`; I hold shift, I type the = key, obtaining the +, then I have to pause typing long enough to release the shift key, type the = key again, and now my other hand has to get involved and type a 1. And that's without the spaces.

Re: Remove the ++ and –- operators

#4
post increment/decrement is definately worth removing imo.

so few people understand its behaviour and it enables some really revolting and difficult to read things. i think a lot of people learned this in the 80s, 90s and 00s even... its not a new revelation.

the pre-increment/decrement though? i think having these is important. there are plenty of contexts away from numbers where they make sense (things can be ordered and not have a concept of addition)

Re: Remove the ++ and –- operators

#6
I've never understood the obsession with avoiding ++ and --. Douglas Crockford advocates the same thing. All of the examples of why it's bad are contrived and set up to fail. In the majority of real world instances, it's just us incrementing or decrementing a single variable.

Re: Remove the ++ and –- operators

#7
post #5

Why not leave those operators for more "advanced" users? I also contest "++" and "--" operators are seriously tripping up "beginners". In most programming books, it's taught a few chapters in...

Because non-advanced users will incorrectly abuse them. That's why ARC doesn't let you call retain and release manually, even though there's no technical reason it couldn't.

Re: Remove the ++ and –- operators

#10

> Their expressive advantage is minimal - x++ is not much shorter than x += 1 Personal opinion, but I definitely miss '++' every time I'm doing '+=' in Python.

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.
Post reply on HN