octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #59847] Unexpected behavior of evalin in some


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #59847] Unexpected behavior of evalin in some cases
Date: Mon, 11 Jan 2021 19:26:20 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #2, bug #59847 (project octave):

With your test, were the functions in separate files?

Could someone try the following test in a current version of Matlab?  Unpack
the attached file.  It will create a directory evalin-bug with the files f0.m,
f1.m, f2.m, and f3.m.  In Matlab, call the function "f3" and report back with
the output it produces.

Octave shows this:


octave:1> f3
f3var = 3
f2var = 2
f1var = 0
stopped in:

  --> f1 at line 3 [.../evalin-bug/f1.m]
      f2 at line 3 [.../evalin-bug/f2.m]
      f3 at line 3 [.../evalin-bug/f3.m]
f0var = 0
stopped in:

  --> f0 at line 3 [.../evalin-bug/f0.m]
      f1 at line 4 [.../evalin-bug/f1.m]
      f2 at line 3 [.../evalin-bug/f2.m]
      f3 at line 3 [.../evalin-bug/f3.m]
Variables visible from the current scope:

f1var


I'm especially curious about what the dbstack function reports here.

The issue is that when "evalin ('caller', 'f0')" is executed, the call to the
function "f0" creates a new stack frame at the top of the call stack and the
"caller" of that is the previous top of the stack (i.e., "f1") not the caller
of "f1".  There is some warning about possible problems with using nested
calls to evalin in the Matlab docs.  Note that if you use evalin in a script
file or if you use evalin in local functions inside a script, you might see
different results.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59847>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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