My thought is: those are “conventions”. i++ could have been named “i+" or “i>” or whatever; you have to map conventions to maths to use them.
With “i=i+1”, you don’t have to remember an “arbitrary convention” to know what it does.
Somewhat like when you see something, you don’t have to speak the actual world to know what the object is…
My take is that ++ and – are very old ideas from the C days. I think {Operator}= is a better way, and then you don’t really need the ++ – syntax.
Don’t forget that you also have other handy things like: *=/=>>=<<=^=&=|= etc.
The pre and post increment & decrement are indeed very old
As far as I know they mapped almost directly onto specific instructions in the PDP-8 where K & R worked on C
Personally IF I was implementing something like this I would maybe add the suffix forms only
i++
i--
as short hand for
i += 1
i -= 1
which are of course shorthand for the verbose ones
The ++i and i++ operators by themselves have the same effect, add +1 to i.
In C they are often used to increment and test at the same time. When they are used inline with another statement, The difference is when the ‘test’ is evaluated.
While they look similar, they can also obscure what is going on.
A simple example: if ( i++ > 5) ...
– vs – if ( ++i > 5) ...
Starting with i = 5.
The first test is false, test first (5), then increment (6).
Where the second version would be true, increment first (6), then test (6).
By themselves they are mostly harmless. Hidden in a line/statement an they can cause no end of grief.
Pretty much…
But also thinking of ease of use – sorry if i keep harping on about LiveCode but multi-d arrays are one of my favourite features of the language and integral to practically everything there. There is no such thing as one-dimensional arrays in LC.
if rootArray or any of the associated arrays do not exist they are created on the spot and the value is assigned. Incredibly flexible and easy to use… i imagine dot notation would be more in XOJO’s style?
Works really well in liveCode anyway and I would really miss it if i came back to XOJO
multi dimensional arrays are not “arrays of arrays” which seems to be what has been requested in some comments
Lately I have been finding that i need arrays of arrays fairly often and don’t like using variants for that, so i have been creating classes for several of the basic datatypes.
Long ago i used a basic like proprietary language with that capability… It comes in handy!