octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More MATLAB Silliness


From: Quentin Spencer
Subject: Re: More MATLAB Silliness
Date: Wed, 06 Oct 2004 08:14:41 -0500
User-agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)

I tend to agree with this. It seems that this behavior comes from the mentality that makes Windows so notorious for security problems: convenience is always the highest priority. All this does is encourage laziness that could come back to bite you if you assigned something to the wrong dimension of an array. When I discovered this "feature" by moving some MATLAB code to octave, I was glad that octave helped me discover what I considered to be incorrect code, even though MATLAB knew what I meant.

-Quentin

Michael Creel wrote:

On Tuesday 05 October 2004 22:33, John W. Eaton wrote:
On 29-Sep-2004, Quentin Spencer <address@hidden> wrote:
| For anyone tracking weird things that MATLAB lets you do that somebody
|
| might ask for in octave someday, how about this:
|  >> a=ones(2,1);
|  >> b(1,:)=ones(2,1);
|  >> whos
|
|   Name      Size                    Bytes  Class
|
|   a         2x1                        16  double array
|   b         1x2                        16  double array
|
| I'm always unintentionally doing things like this in my code (assign a
| column vector to a row of a matrix), and in the past both Octave and
| MATLAB would give you an error, and I would fix it. Release 14 appears
| to have changed this to automatically detect what you meant to do and
| take care of it for you. A nice thought, I suppose, but I wonder what
| unintended consequences this could cause for an unsuspecting user. Are
| there any reasons other than convenience why this behavior is good? Any
| guesses on how many releases until they remove this feature?

I suspect that this behavior is allowed because the orientation of
vectors is considered unimportant.

Should we copy this behavior?

The problem I see is that you can be tripped up if you are writing
code that is expected to work with matrices but only test your code
with matrices that have one row or column.  Then it can appear that
your code is OK during testing and fail later when someone tries to
run the code with matrices that have rows and columns both greater
than 1.

jwe

IMHO, stuff like this, if used, makes for hard to understand and maintain code. Another question is what this could be good for? But on the other hand, I can appreciate the attractiveness of compatibility when it's possible. Does Octave want to attract all Matlab users, or just the ones that program in an intelligible way?
Michael





reply via email to

[Prev in Thread] Current Thread [Next in Thread]