help-octave
[Top][All Lists]
Advanced

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

Function cache too tenacious


From: Julius Smith
Subject: Function cache too tenacious
Date: Fri, 22 Nov 2002 12:13:42 -0800

Hello,

I'm running Octave version 2.1.36 on a Linux PC, and I encountered a what appears to be a bug in function caching behavior. Briefly described, I often debug functions by commenting out their declaration line at the top and invoking them by name only (after setting up arguments using assignments). This helps because all the function local variables become available in the top-level scope where they can be inspected. The problem I found is that Octave seems to be trying to use the function definition after I have "overridden it" with a script version of the same name. Even more surprising, "clear functions" does not fix the problem. However, an explicit "clear function-name" does work, so that's a workaround. All of this is illustrated in the diary output below:

octave:2> echo on
octave:3> type testfn
testfn is the user-defined function defined from: /filters/matlab-fp3/testfn.m

function [y] = testfn(x)
y = x
octave:4> x = 1
x = 1
octave:5> y = testfn(x)
y = 1
y = 1
octave:6> % <edit function to comment-out the function line>
octave:6> type testfn
testfn is the user-defined function defined from: /filters/matlab-fp3/testfn.m

%function [y] = testfn(x)
y = x
octave:7> testfn
error: `x' undefined near line 2 column 5
error: evaluating assignment expression near line 2, column 3
error: called from `testfn' in file `/filters/matlab-fp3/testfn.m'
octave:7> x
x = 1
octave:8> clear functions
octave:9> testfn
error: `x' undefined near line 2 column 5
error: evaluating assignment expression near line 2, column 3
error: called from `testfn' in file `/filters/matlab-fp3/testfn.m'
octave:9> x
x = 1
octave:10> clear testfn
octave:11> testfn
+ %function [y] = testfn(x)
+ y = x
y = 1
octave:14> version
ans = 2.1.36
octave:15> diary off



-------------------------------------------------------------
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]