help-octave
[Top][All Lists]
Advanced

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

Global functions taking precedence over subfunctions


From: Rafael Laboissiere
Subject: Global functions taking precedence over subfunctions
Date: Thu, 1 Sep 2005 20:36:32 +0200
User-agent: Mutt/1.5.9i

I do not know whether the following is a bug or a feature.  Consider the
two following files:

%%%%%%%%%%%%%% f.m %%%%%%%%%%%%%%%%
function f;
  g;
  function g
    disp ("local g")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        
%%%%%%%%%%%%%% g.m %%%%%%%%%%%%%%%%
function g
  disp("global g");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          
Put only f.m in LOADPATH and you have:

> f
local g

Put now g.m in LOADPATH, restart Octave, and you will have:

> f
global g

The global definition is taking precedence over the local one.  Is it
normal?  I find it counterintuitive.  FYIY, This happens in Octave 2.1.71
and 2.9.2.

-- 
Rafael



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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