6 ms·
It's "fine" for imperative programming if you never make a mistake: the problem is that it is extremely permissive and won't stop execution on errors. I usuall
by kmill 6y ago
It's "fine" for imperative programming if you never make a mistake: the problem is that it is extremely permissive and won't stop execution on errors. I usually add my own error checking and default cases to cause programs to halt, and these help a lot, but there are still a number of footguns.
One example is what happens if you map a function f over a list lst: f /@ list. Oh, the variable was called lst and not list? Mathematica will happily evaluate this and result in list, assuming list has not been defined. This is because what /@ does is apply f to each part of the expression, and a Symbol has no parts. If Mathematica had a way to declare which global symbols can be used in local expressions, it might help prevent this class of bugs.