octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab compatibility of assert


From: Julien Bect
Subject: Re: Matlab compatibility of assert
Date: Tue, 24 Sep 2013 17:18:12 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 24/09/2013 15:47, John W. Eaton wrote:
We also have a Matlab compatibility problem here. Octave introduced assert a long time ago as part of the unit test functions. Later, TMW added an assert function with a different interface to Matlab:

http://www.mathworks.com/help/matlab/ref/assert.html?searchHighlight=assert

In the simple one-argument case I think they work in essentially the same way. But with additional arguments, Matlab's assert is much different from Octave's. I don't think there is any way to provide both forms without breaking backward compatibility for Octave.

What exactly is so different between both versions of assert ?

It seems to me that Octave's assert behaves almost exactly as Matlab's assert when there are more than one argument and the second argument is a string (interpreted as an error message).

When the second argument is NOT a string, Octave has of course a very different behaviour, but in this case Matlab just raises an exception. Why not send a warning in this case in --braindead mode, to alert on the use of a Matlab-incompatible syntax ? (and disable the warning in --traditional).

There are still cases that Octave does not support : when the second (string) argument is an error identifier, and also when the second argument is an error structure. Is this what you are referring to when you say that Matlab's assert is much different from Octave's ?

@++
Julien


reply via email to

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