>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.
> what the fuck is x plus equals 1 supposed to mean! THATS NOT ENGLISH!
>I demand you change it to x = x + 1
Logan Campbell
according to swift 3, retarded += 1
Wyatt Williams
To be honest, it's a bad operation that allows two assignments at once.
Owen Perry
x=1 wouldn't make any intuitive sense to me at all either, I don't understand the change desu
Grayson Garcia
x+= rather
Jace Murphy
++ 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.
Ryder Lee
It should be >++these guys are fucking retarded
Michael Reed
I'm mentally challenged: the post.
Eli Howard
How is that better than x++
David Reed
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?
Camden Parker
are u dum or somthing
Gabriel Long
Python designers are retarded.
Kayden Jones
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.
Nolan Sanchez
>*dest++ = *source++ The non readbility does not come from ++, it came from mixing postfix and prefix operators.
Henry Clark
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
Eli Martin
>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.
Jonathan Wood
> Two smart people and 10 dumb kids. Stay good Sup Forums
Alexander Lopez
swift is a yuppie numale language, so there's no reason to care
James Martinez
>x = x + 1 // -x >0 = 1 bravo programmers it doesn't make sense I demand every operator to make sense in simple mathematics
Colton Adams
it would be extremely painful
Lincoln Gomez
Why is += and not =+?
Hudson Kelly
Because if you combine minus sign and equal sign, you get =-. Whart kind of this expression would be? a=-5;
Benjamin Green
Lua doesn't have +=. That's the main thing I dislike about it. I can understand not including ++ though.
Christian Baker
+=1 is literally one more character. If you don't need the post and prefix behaviors why bother including ++ at all?
Ryan Anderson
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.
Elijah Wilson
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.
Asher Hall
Why not? i++ is one of the oldest meme in coding.
By the way I don't care about shitty swift.
Ryan Howard
>C++ I think you mean C+=1
Connor Hill
>Apple removes features Nothing new here.
Luke Ortiz
>I much prefer to run across the latter in software I take over. Your parents were unfit to raise a child
>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?
Jackson Cook
C# still has increment operators.
He's testing you.
Nathan Reyes
>Trigger Warning, this repository uses satire and sarcasm and other types of humor that could trigger Feminazis into rage fits.
* - C+= considered phallic; replaced with (and pronounced) "Xe", * source files have extension ".Xe" * * - header files are known as headHer files, with extension .Xir
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
Isaac Ramirez
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.
Dominic Gomez
>appletoddlers will defend this
Jace Evans
still rather use it than obj-c
Adrian Hall
This.
Daniel Johnson
>Taking cues from a language that shit like $python $python2 $python2.6 $python3 $python3.5 binaries
Hunter Garcia
++ and -- are convenient to use in for/while loops
Jacob Smith
# or just x += 1
Ayden Murphy
Sauce
Levi Davis
>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 ++.
Christian Powell
>Think different
Levi Gutierrez
>applel
Jayden Thomas
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;
Daniel Bell
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.
Michael Carter
whats so bad about that, you mouthbreading retard?
Lucas Miller
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.
Wyatt Anderson
>operator overloading >Sometimes that ++ doesn't do what you'd think it does.
This is just as true for + by itself.
Leo Watson
Swiftfags will defend this.
Carter Taylor
I think that's a problem with operator overloading and not ++ itself.
Aaron Russell
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.
Camden Campbell
Exactly. Let's ban any expressions where a variable occurs both on left hand and right hand side. They're so difficult to understand.
Jackson Hill
>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?
Nicholas Williams
>x++ is not much shorter than x += 1.
It's much shorter if you're actually using it properly to reference then increment.
Benjamin Perry
The only problem with ++ is if you use c++ when ++c should be used.
Alexander Cook
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
Nathaniel King
>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 ==?
Owen Clark
>not doing asm ("incq %0" : "+m" (x));
Benjamin Lee
So they basically copied from other guys that are also known for being incapable of good language design?
Joseph Carter
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.
Samuel Johnson
it's not consistent with assignment because it's more than just an assigment. Post increment is not assigned right away.