3 ms·
> Indexing backwards from the "end". Your language can always add an `end` keyword like Matlab does, and this stops Having used Matlab a bunch, in practice thi
by jacobolus 8y ago
> Indexing backwards from the "end". Your language can always add an `end` keyword like Matlab does, and this stops
Having used Matlab a bunch, in practice this sucks, because “end” is treated as this weird special case in the language grammar, and many reasonable and convenient expectations of syntax that should work turn out not to. Folks writing complicated Matlab projects end up needing to work around it, and the workarounds are brittle and confusing.
Using negative integers is a whole lot easier to reason about and work with.
Everyone learns in grade school how to do arithmetic with negative integers (adopted by European mathematicians in the 17th century). Even Matlab experts don’t always understand Matlab ‘end’ arithmetic.
- tomtimtall 8y agoDo you have any examples? In all my years of teaching and working with matlab I have literally never seen any student or code that showed such issues so I am very curious?