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 order…
Remove the ++ and –- operators
11–20 of 249 posts
Re: Remove the ++ and –- operators
#12> 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.
Re: Remove the ++ and –- operators
#13Re: Remove the ++ and –- operators
#14I'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
#15Why 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.
I don't see how this is a valid reason to remove the operators completely. Beginners will get it wrong sometimes, so we should remove it?
Beginning users are likely to make all kinds of errors, so the implication would be maybe we should remove the entire language...?
Not to mention, pre-decrement and post-decrement are not complicated concepts. There are many valid reasons to use both, although post-increment/decrement seems to be the more common use.
Re: Remove the ++ and –- operators
#16Re: Remove the ++ and –- operators
#17Re: Remove the ++ and –- operators
#18And there is no ++ equivalent of x += 2.
Re: Remove the ++ and –- operators
#19Earlier quoted context omitted.
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.
> Because non-advanced users will incorrectly abuse them. I don't see how this is a valid reason to remove the operators completely. Beginners will get it wrong sometimes, so we should remove it? Beginning users are likely to make all kinds of errors, so the implication would be maybe we should remove the entire language...? Not to mention, pre-decrement and post-decrement are not complicated concepts. There are many…
Swift does include them, but puts a screaming "Unsafe" in front of their type names so that it's clear that unless you really know what you're doing, you're probably doing something wrong.
There's no way to do that with a ++ operator, so it's being removed.
Re: Remove the ++ and –- operators
#20Funny given the name of the language.