[Top][All Lists]

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

[Octave-bug-tracker] [bug #56881] Command line functions are visible fro

From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #56881] Command line functions are visible from m files
Date: Fri, 13 Sep 2019 15:12:21 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #8, bug #56881 (project octave):

Isn't it also possible for functions defined in files to shadow built-in
functions or other functions in the path?  Doesn't that happen whether these
"evil" functions are found elsewhere in the path or in the current working

For example, if I place the following function in my current directory and
execute "sombrero", I get "HAHAHA!" error message instead of a pretty plot.

function surf (varargin)
  error ("HAHAHA!");

Isn't this just one of the long-standing problems with Matlab that TMW has
been trying to fix for a couple of decades now by introducing things like
subfunctions, private functions, nested functions, packages, and classdef

I don't see how it is any different for functions defined in files or at the
command line.

I thought it was supposed to be possible to even overload + for doubles by
adding an @double/plus.m file in Matlab.  Is that no longer true?  Or am I
mistaken and that was never true?

Does Matlabl really limit function resolution inside core functions to only
other built-in or core functions?  Does it also do that for toolbox functions?
 If so, what are the rules?  Are they clearly documented somewhere?

We do warn when built-in functions are overloaded by user-defined functions,
but only when a directory is added to the load path, not when a file is added
to a directory that is already in the load path.  Maybe we could expand the
warning to happen any time a function is loaded that will shadow another
function in the path?  I don't know, that might be annoying?  We could
certainly do it for command line functions.


Reply to this item at:


  Message sent via Savannah

reply via email to

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