News for hackers. Stuff that matters.
Re:Worst Bug Ever by jstanley on Monday January 21, 2013 @11:27AM (#5092128)
Unlike many of the other commenters, I don't see much problem with having "i" mean the imaginary unit. Where MATLAB falls down though is:

1.) not having lexical scoping

2.) not having warnings when a global is overridden in a local scope

these are pretty inexcusable. For anyone looking for a "better MATLAB", Python has NumPy, SciPy and Matplotlib which are pretty much everything.

Re:Worst Bug Ever by w0utert on Monday January 21, 2013 @12:18PM (#5092410)
>> For anyone looking for a "better MATLAB", Python has NumPy, SciPy and Matplotlib which are pretty much everything.

I hear this at work all the time, "just use Python, we're going to use Python everywhere we use Matlab from now on". It simply doesn't work like that.

Usually it's programmers who are too overly enthusiastic about replacing Matlab with Python, because they are comfortable with all aspects of programming languages. The people typically writing the most complex Matlab code aren't, more often than not they are physicists or mathematicians. Python + SciPy + Matplotlib is not nearly as accessible as Matlab, and you drag in all kinds of typical 'software engineering' problems that don't exist when you stay inside the Matlab IDE and its related tools. I can conjure up a plot in Matlab and manipulate it incrementally for example, while Matplotlib often requires a lot of crazy data mangling and setup code that isn't required in Matlab (trust me, I've spent months re-implementing a library of Matlab plotting scripts in Matplotlib, and the code of some of them is completely untraceable to the original Matlab code, and full of stuff completely unrelated to plotting). Also, lots of Matlab code relies on all the crazy implicit operations and type juggling allowed by Matlab, many of which are almost fundamentally incompatible with a well-defined programming language suited for production code.

This is all even ignoring the fact that Matlab comes with a pretty extensive library of toolboxes that have no equivalent in SciPy or Numpy. If you're really determined and know how to program in Python, you can basically get a lot of stuff done without requiring Matlab, but if you've always been using Matlab like a prototyping tool or a very elaborate graphical calculator (and this constitutes a very extensive part of Matlab users), Python + all its scientific libraries is no substitute.

Re:Worst Bug Ever by jstanley on Monday January 21, 2013 @12:27PM (#5092472)
Good points, and that provides some perspective I hadn't considered.

However, I still think my points about where MATLAB falls down are valid. There is no reason for it not to have lexical scoping, or warnings about when you are doing stupid things. It just doesn't have them, and it causes frustrations like the one in this article.

Re:Worst Bug Ever by w0utert on Monday January 21, 2013 @01:36PM (#5092891)
Oh totally agree, Matlab-the-language is terrible, and Python is a million times nicer to work with. My comment was only about the suitability of Pyhton + Numpy + SciPy + Matplotlib as a Matlab replacement for non-programmers.
Re:Worst Bug Ever by anonymouz on Monday January 21, 2013 @05:06PM (#5094010)
Octave would be a closer equivalent of Matlab, but is also terribly lacking in features compared to Matlab.

And despite not being a fan of closed source software in general, I must say that Matlabs "IDE" is hugely convenient and, for its purpose, far ahead of anything else out there.

Re:Worst Bug Ever by eddins on Monday January 28, 2013 @04:34PM (#5130799)
Can you say more about these complaints? I would like to understand them better.

With respect to complaint #1, based on the Wikipedia definitions of lexical and dynamic scoping, MATLAB has lexical scoping of function variables. Can you say more about what you mean?

With respect to complaint #2, I think it might be based on other comments in this thread. Other commenters have suggested that "i" in MATLAB is a special kind of global constant that is prone to getting unintentionally overridden. That is not the case, however. "i" is simply a function in MATLAB, as are "j" and "pi".

When a user assigns to "i", as in i = 5, it has the effect of creating a variable called "i". The variable "i" shadows the function "i" based on the rule that local definitions of names take precedence over names defined further away. That's a perfectly ordinary and common programming language convention.

If you create a variable "i" by assignment and then call a function, that function has its own set of variables and doesn't see the variable "i" in the caller. There's no global override happening.