I'm looking at a programming language design decision that's difficult to make precisely because there seems to be no objective basis for choosing one option over the other. The question is, given that a language doesn't have a ++ operator, would the better choice for an increment operator be as in C:a += 1a += bor as in some versions of Pascal:inc ainc a b(And similarly with -= vs dec of course.)Considerations I can see for inc:Slightly shorter for the typical case where the delta is 1.Less familiar to most programmers.Eliminates the corresponding *= etc operators, which are much less commonly used.Is there anything I'm missing?
Inc/dec vs +=/-=
language design
I think inc and dec are a poor choice, for the following reasons:They are abbreviations and abbreviations should be avoided. At the same time increase and decrease would be a lot to write.They introduce extra keywords. A language should have as few keywords as possible, so that programmers are as free as possible in their choice of names.inc a b is a binary prefix operator. In C-style-ish languages, almost all binary operators are all infix (except array access).Unlike += and -= they don't emerge from a rule, but are arbitrarily chosen. Once you understand that L o= E means L = L o E, you can use this with any operator. Personally I use *= and /= quite often (scale up, scale down), as well as ||= (set if null (this actually depends on the language)), &&= (good for aggregating conditions).  That last point is the most important one. When designing a language, you want few features that compose well rather than having a lot of idiosyncracies to be memorized.Your language has pure binary operations and assignments. And anyone can write a = a o b already (thus explicitly composing assignment and the binary operator o). Adding inc and dec and whatnot to the cocktail is not good, because it is a non-evident choice, that covers a single case.As a counter example: adding call by reference for example allows programmers to roll their own inc if it pleases them. That's a powerful feature. Similarly, allowing the combination of any binary operator with an assignment operator also composes well, because it works with any operator.