Following this question on the plus operator I have a follow-up question. We know the difference between plus and uplus, and thus that 1+2 resolves to 3, just as 1++2 or even 1++++++++2. The strange thing happens in array syntax, consider this example:
>> [1 ++ 2]
ans =
1 2 % Two unary plusses
>> [1 + + 2]
ans =
3 % A normal plus and a unary one
>> [1++2]
ans =
3 % A normal plus and a unary one
The same works with multiple plusses, [1 +++..+++ 2], so with all plusses consecutively in the middle generates [1 2], all other combinations (as far as I tested) result in 3.
As far as I know spaces are of limited importance in MATLAB; exp(3*x/y) is the same as exp( 3 * x / y ). There is a use for them in creating arrays: [1 2] will generate a 1 -by- 2 array, and there are a few other uses, but separating operators is not one of them.
Therefore my question: Why do [1 ++ 2] and [1 + + 2] resolve differently?
Note that the minus and uminus have the same behaviour, and that the parser is magic enough to parse [1;;;3++ + + +--+ + ++4,;;;,;] perfectly fine to [1;7].