Unexpected behavior with built-in

John W. Eaton jwe at octave.org
Tue Jul 21 10:29:33 CDT 2009


On 20-Jul-2009, Joel LeBlanc wrote:

| 1)  Trying to access the next lower member of a function in the precedence
| chain from an overloaded function.
| 2)  Trying to avoid any potential overloading by reaching the lowest member
| on the precedence chain.

I'm not sure what you mean by "lowest member".

When Octave looks for the definition of a symbol, it searches in the
following order:

  variable
  subfunction
  private function
  class constructor
  class method
  legacy dispatch
  command-line function
  autoload function
  function on the path
  built-in function

Since "builtin" searches for functions by name only (no argument list
is provided) we can skip variables and class constructors and
methods.  So we are left with

  subfunction
  private function
  legacy dispatch
  command-line function
  autoload function
  function on the path
  built-in function

You are saying we should skip subfunctions too, which I agree makes
sense if we are looking for "builtin" functions.  Should we also skip
private functions?  What about command-line functions?

If we can decide which of these to skip, it should be relatively easy
to implement.

Are you also saying that we should be searching in the reverse order,
but omit some (subfunctions, maybe private functions) even if they
exist?

Or, we could just do what Matlab does and only find those functions
that are actually built in to the interpreter.

No matter what we do, we will get incompatible behavior, because the
list of functions that are built in to the interpreter is different
for Octave and Matlab.

jwe


More information about the Bug-octave mailing list