[Changeset] Compatibility fix for assert

John W. Eaton jwe at bevo.che.wisc.edu
Mon May 12 22:26:22 CDT 2008


On  9-May-2008, David Bateman wrote:

| Matlab's assert function doesn't have the same syntax as Octave. There
| is an overlap in that assert(cond) is the same. However, matlab doesn't
| accept the expected value or tolerance arguments but instead accepts an
| error message, msgid and additional arguments to print.
| 
| If we assume that if the first argument is logical and the second a
| string, then we have a matlab compatible use of assert it is easy to add
| this feature, and the attached changeset does this.

I applied it.

| We might even
| enlarge the case to have isnumeric(cond) and second arg is a string be
| accepted, but in that case assert(3,"dog") will change its behavior.

I don't have a strong opinion about this, but now that Matlab has this
function, I suppose we need to be careful about adding additional
extensions to their behavior that might cause compatibility problems
in the future.

Thanks,

jwe


More information about the Octave-maintainers mailing list