Function handles for nonexisting functions

Moritz Borgmann octave at moriborg.de
Sun May 4 11:59:41 CDT 2008


In Matlab, I can create function handles to nonexisting functions 
using str2func or the @ operator. Only when I try to call the 
function, an error like the following occurs:

??? Undefined function or method 'blabla' for input arguments of type 'double'.

In Octave, it seems that existance of the function is checked already 
upon creation of the function handle. This means that the str2func or 
@ call can fail with something like

error: error creating function handle "@blabla"

which would not happen in Matlab.

Now I'm not certain how important this difference in behavior is, how 
much of a conscious design decision was behind the Octave 
implementation, and how much effort it would be to change. To avoid 
subtle failure when porting code, I'd have a slight preference for 
making the behavior compatible. What's the general opinion on this?

-M


More information about the Octave-maintainers mailing list