Swift 3 removes ++ and --

Apple's excuses:

>These operators increase the burden to learn Swift as a first programming language - or any other case where you don't already know these operators from a different language.

>Their expressive advantage is minimal - x++ is not much shorter than x += 1.

Other urls found in this thread:

github.com/ErisBlastar/cplusequality
github.com/ErisBlastar/cplusequality/blob/master/fizzbuzz.Xe
twitter.com/SFWRedditImages

these guys are fucking retarded++

That's exactly why they're not in Python either.

>not doing
x = x + 1;

> what the fuck is x plus equals 1 supposed to mean! THATS NOT ENGLISH!

>I demand you change it to x = x + 1

according to swift 3, retarded += 1

To be honest, it's a bad operation that allows two assignments at once.

x=1 wouldn't make any intuitive sense to me at all either, I don't understand the change desu

x+= rather

++ and -- (prefix or postfix) are stupid operators.

The only reason they exist is to allow retardedly 'clever' code in C.

while (*source)
*dest++ = *source++;


That doesn't offer any advantage over:

while (*source)
{
*dest = *source;
source += 1;
dest += 1;
}


And, generally speaking, I much prefer to run across the latter in software I take over.

And when it comes to C++ and objects, the postfix operators mean you have to create a fucking duplicate of the object to return. Horrible idea.

It should be
>++these guys are fucking retarded

I'm mentally challenged: the post.

How is that better than x++

jokes on you, why da actual fuck waste time a programming language by apple of all tech coprs??????

alright it must be to develop ios programs for the cash burning apple crowd, cant you develop native programs for ios directly on C or something?

are u dum or somthing

Python designers are retarded.

When you kids grow up, you'll realize that clever code is virtually useless.

The single most important thing in writing software is correctness. The next most important things are READABILITY and MAINTAINABILITY.

Cleverness works against READABILITY and MAINTAINABILITY.

Did I think "*dest++ = *source++" was neat when I was 17? Yes. Do I think it's neat now? No. It's a waste of company time.

>*dest++ = *source++
The non readbility does not come from ++, it came from mixing postfix and prefix operators.

What is it with you and "clever code"?
incrementing something as i++ is no "clever" and people who increment as such don't think it's clever

>incrementing something as i++ is no "clever"

You are an idiot. "*dest++ = *source++;" contains an assignment, two dereferences, two copies, and two increments. All on one line.

That is a bad idea in production code. And for what? More compact code.

Compressing more operations into the same space makes code harder to maintain. This isn't some, "oh programmers have a hard time reading that" issue. This is "over the course of a decade, tens or hundreds of pairs of eyeballs will scan that line, and the 'clever' version will slow those eyeballs down, and set off a series of events resulting in a bug 1% of the time".

If you want to be a professional software engineer, you'd better start thinking about long-term scale, rather than Sup Forums's try-hard "oh so 1337" approach to life.

> Two smart people and 10 dumb kids.
Stay good Sup Forums

swift is a yuppie numale language, so there's no reason to care

>x = x + 1 // -x
>0 = 1
bravo programmers
it doesn't make sense
I demand every operator to make sense in simple mathematics

it would be extremely painful

Why is += and not =+?

Because if you combine minus sign and equal sign, you get =-.
Whart kind of this expression would be?
a=-5;

Lua doesn't have +=. That's the main thing I dislike about it. I can understand not including ++ though.

+=1 is literally one more character. If you don't need the post and prefix behaviors why bother including ++ at all?

it's even worse than that.

it's because to C people this strcpy is like the deepest and most elegant thing ever:
while (*dst++ = *src++);

Array decay, in-band C string termination (or overflowing!), and post-increment/decrement go hand in hand.

Preincrement/decrement is a fundamentally more efficient operator (compiler optimizations aside) since there's no implicit mandatory copy, but postfix unary operators generally lead to better readability by facilitating operation chains without parentheses forests.

Say what you want. I find the ++ much clearer when trying to understand what's going on in the code.
Yes, there's more stuff going on in one line, but it's as easily understandable as another single line.
Personal preference, I guess. Or just years getting used to it.

So the only real argument remaining is that learning it is extra burden of knowledge.
And whether it's that much of a deal is down to Swift devs.

Why not? i++ is one of the oldest meme in coding.

By the way I don't care about shitty swift.

>C++
I think you mean C+=1

>Apple removes features
Nothing new here.

>I much prefer to run across the latter in software I take over.
Your parents were unfit to raise a child

They copy M$.

Nothing new here as well.

no that's another language
github.com/ErisBlastar/cplusequality

I'm not sure if this is a joke or not

>mfw my company's senior programmer told me x+=1 was invalid syntax today

he's a .net guy though, don't know if it's invalid or unusual syntax there. still, i'm just a student worker, how the fuck am I teaching this guy anything?

C# still has increment operators.

He's testing you.

>Trigger Warning, this repository uses satire and sarcasm and other types of humor that could trigger Feminazis into rage fits.

FSF femisnt softw foundation

Yes C# is a decent language.

github.com/ErisBlastar/cplusequality/blob/master/fizzbuzz.Xe

* - C+= considered phallic; replaced with (and pronounced) "Xe",
* source files have extension ".Xe"
*
* - header files are known as headHer files, with extension .Xir


#consider

xe womain (xe RequestCount, strong *RequestList[]) {
//Always check your privilege
CheckPrivilege();


xe ThePlaceBetween accepts(present(0));

among(ThePlaceBetween accepts(ArbitraryBeginning),
ThePlaceBetween honors(ArbitraryEnd),
ThePlaceBetween improvesBy(present(1))) {

check(ThePlaceBetween envelops(present(3))) {
yell(present("Fizz"));
ENDMISOGYNY
recheck(ThePlaceBetween envelops(present(5))) {
yell(present("Buzz"));

Your stupid example isn't even hard to read. It dereferences a pointer and then, as implied by the name *POSTFIX* increment, increments the pointer AFTER evaluating the expression. This is really fucking basic shit. Anyone who's touched C for more than a month will be able to understand that code, unless their problem is understanding pointers in which case they're screwed anyway.

These operators can be used in simple things like:

while(i++ < MAX)

Instead of something stupid like:

while((i = i + 1) < MAX)

Besides, this isn't an issue with the ++/-- operators. This is an issue you can get in ANY programming language that provides more expressibility than BASIC. It isn't the fault of the operator. If someone writes an unreadable mess of code because they're being "clever" with operators (your example is not very clever and easy to parse) then it's just a shitty programmer, which is not the fault of the operator.

People write "clever" code in Python too you know, despite the lack of the prefix/postfix operators. People also write stupid fucking shit with the ternary operator (the ?: operator), like this:

return i > 0 ? i

In the first version of C, it was. Then they realized that was a bad idea, and changed it. It's been that way ever since.

>appletoddlers will defend this

still rather use it than obj-c

This.

>Taking cues from a language that shit like $python $python2 $python2.6 $python3 $python3.5 binaries

++ and -- are convenient to use in for/while loops

# or just
x += 1

Sauce

>removing shit from your language because its hard for beginners to grasp

oh good idea. while you're at it, might as well remove conditionals, iteration, and any form of value assignment as well, since most people entering their first programming course fail it, and those who don't aren't going to suddenly get stuck on ++.

>Think different

>applel

This is not obvious to beginers either. Lets do
first_sum_operand = x;
second_sum_operand = 1;
sum_result = first_sum_operand + second_sum_operand;
x = sum_result;

x++
is explicitly banned at a place I work at. it's in our coding standards for C++11. I work for a large defense industry contractor that you've probably heard of and we even work on civilian tech (rockets etc).

It's banned because of bugs and readability issues that operator overloading introduces. Sometimes that ++ doesn't do what you'd think it does.

Don't know Swift but they're correct for completely removing it.

whats so bad about that, you mouthbreading retard?

This is part of the trend to try to dumb down / lock down languages to make them more appealing to normies. This is what you get with pajeet, rajeesh, mommy coders, and the push to teach every kid programming.

>operator overloading
>Sometimes that ++ doesn't do what you'd think it does.

This is just as true for + by itself.

Swiftfags will defend this.

I think that's a problem with operator overloading and not ++ itself.

This actually makes sense. x++ is not consistent because it's not obvious x is assigned a new value.

then again, autists who don't even use swift will never understand this. they'll rather program in old languages.

Exactly. Let's ban any expressions where a variable occurs both on left hand and right hand side. They're so difficult to understand.

>conditionals are obvious
>iteration is obvious
>pointers are obvious
>event handling is obvious
>inheritance is obvious
>overriding is obvious
>threads are obvious

But not ++. Fuck ++, amirite?

>x++ is not much shorter than x += 1.

It's much shorter if you're actually using it properly to reference then increment.

The only problem with ++ is if you use c++ when ++c should be used.

the only waste of company time here are the employees who have trouble reading that or don't know what postfix or prefix increment is

>because it's not obvious x is assigned a new value.
It is if you have fucking learned your operators.

It's not obvious to someone who hasn't coded before that == doesn't assign a new value. Should we remove ==?

>not doing
asm ("incq %0" : "+m" (x));

So they basically copied from other guys that are also known for being incapable of good language design?

Did you know that python had a fucktarded dictionary implementation until 3.6? In 3.6, they finally implemented the naive version of dictionaries. The result they found? It was significantly faster and used significantly less space.

it's not consistent with assignment because it's more than just an assigment. Post increment is not assigned right away.