This is what i mean with a sort of special syntax. It's awful corner case.
I don't like the Python syntax either. What would be wrong with Math.C(1,1) for 1+i? Or how about 1 + Math.I ?
I don't have a problem with using i or j as the complex constant, as long as the necessary sanity checks exist to make sure it's not misused (e.g., duplicate declaration of i/j, overwriting i/j, etc).
Sort of like how PHP will treat undefined constants as unquoted strings. Like if that made any sense... At least PHP will trigger a warning if you do that.
The use of j is common in electrical engineering, where i denotes current.
The bug described in the article is impossible in Python (and probably in most other programming languages with native support for complex numbers) because `1j` is not a valid identifier.
It's not really mutable, because it isn't a variable. However, if there is a variable by that name, Matlab will use it instead of the complex constant.
> - It a feature that has a special syntax (sort of).
The problem is rather a lack of special syntax (or too much leniency). Python also has built-in complex numbers:
but it doesn't allow you to omit the constant before the j: You can do it the same way in Matlab to avoid this problem (1 + 1i is always OK since implicit multiplication is not allowed), so the problem is that Matlab lets you use i syntactically like a variable when it in fact isn't.