I know this is a highly contentious issue and many people will be angry about me bringing this up. But I’m going to do it anyway, because I believe it’s important. You may not agree with me, but I request that you try to understand my point of view because I have tried to understood yours and I’ve provided a counter argument below.
In my opinion code readability and code density in Xojo is unnecessarily high because of the lack of common operators in the language. Yes, I’m talking about: ++, --, +=, -=, *=, /=
and whatever else I’ve forgotten, with the exclusion of heavier operators like <<, >>
which I don’t think belong in the language.
My Argument
I will say that i++
is shorter, easier to write and easier to understand than i = i + 1
. This is especially true in nested loops and for variables with very long names: Car.Engine.Piston.Width++
instead of Car.Engine.Piston.Width = Car.Engine.Piston.Width + 1
. If you have to do this often enough in your program it becomes a very dense thing with a lot to consider. You must ask yourself “Now is this just an increment, or a more complicated operation?” If I see ++ I can stop reading - I know immediately what it does. With the alternative, I have to read the entire equation to figure out what it’s doing. This makes processing code without the operators harder for me to understand and more likely to produce logic errors. It’s also very ugly and contributes vastly to code density, because everything is twice as long as it needs to be.
Opposite argument
Now I understand the argument of the other people here who hate these other operators. They say that:
a) You don’t know what the operator does until you read about it, making it harder for new people to learn
I disagree with this point because this is simply the nature of programming, and it doesn’t stop there. As a beginner you have to go and read up on a lot of things including the various data types, the differences between a for loop and a while loop, what a class is, what observers do, and so on and so forth. These are all more complicated concepts than a ++ operator. Now if I have to look up all of that and understand these concepts, how will a lack of a convenient operator help me? It won’t. It just limits everyone else because of some imaginary beginners.
Beginners aren’t idiots, and programmers aren’t idiots. A ++ operator doesn’t transform a piece of code into rocket science. The truth is that if someone can’t go and look something up then they won’t get far with programming in general.
b) I don’t want to use it!
Ok, you don’t want to use it. That’s ok, you can still write it how you want. It’s the same as many things in life: Live and let live. You don’t want to drive a motorcycle? Ok, don’t drive one. You don’t want to write ++? Ok, write it the long way. It’s your choice. But just because you don’t want to drive a motorcycle doesn’t mean that nobody else shouldn’t be allowed to. That’s a form of extremism. Xojo wants to be an inclusive thing, not something that forces a dogma onto people. If it does, then that’s something very toxic that will hinder Xojo from ever becoming a more popular language.
c) If these operators were in Xojo, I’d have to read your code!
Nobody is forcing you to read my code. I don’t have a gun to your head. You can choose to read my code or choose not to.
d) ++ and += etc are not intuitive to someone with 0 knowledge!
Like I said before, neither are loops, classes, observers and datatypes. These are things you have to look up.
e) Adding these operators will lead to incrementalism. Next thing you “You added those, so why not just add ___ too”
This point has a little more merit to it. I agree with it, I guess. But I think it could be mitigated against. Xojo has to draw the line in the sand at some point. I think the line is this: as soon as someone wants to start manipulating bytes and bits, then they should go and get themselves C. But we aren’t talking about low level manipulation here. We’re talking about shortening a normal expression for readability’s sake - a good idea, hence why it’s so widespread.
f) The biggest downside to adopting any of the -=, +=, /= *= operators is that they break backwards compatibility
A valid point. Easily refuted, however: Xojo is constantly evolving. At some point old code will break no matter what.
g) I don’t want to write C syntax!
C had good ideas. It was written by Dennis Ritchie, someone I consider to be a genius. It’s simply foolish to throw away good ideas because you don’t like their origins.
h) My brain stops working when I see this stuff!
…What? Ok. Just write it the long way then. Limiting the rest of us because of your problem isn’t fair.
i) Xojo’s customers aren’t the kind that want this type of stuff!
Wrong. Many people want this. Especially everyone coming from other languages.
Maybe I missed a point that someone brought up. If so, you can write it below and I’ll consider it. Maybe you can even change my mind. This thread isn’t some mindless or offensive trolling. It’s for level-minded discussion. If it becomes locked then I would certainly see Xojo Inc in a different light. I don’t see any reason for anyone to be angry about this, actually. Anger has no place anywhere. It’s just childishness.