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

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

[Octave-bug-tracker] [bug #35881] clear all removes subfunctions


From: sergey plotnikov
Subject: [Octave-bug-tracker] [bug #35881] clear all removes subfunctions
Date: Tue, 26 Nov 2013 14:51:07 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36

Follow-up Comment #6, bug #35881 (project octave):

Playing with that _testnestfun()_ in ML have led to interesting conclusion:

0 "clear functions" doesn't clear nested/sub- functions when called, so those
guys are probably locked by default during the whole run of the main function
0 persistent variables are not reinitialized at the moment of "clear
functions", but at the very beginning *and* at the very end of the main
function:
0 below are results for the following function

function testpersist
  persistent x;
  x
  if isempty(x)
    x = 1;
  end
  clear('functions');
  x
end


*1st test, two consecutive calls*
+verbatin+
>> testpersist
x =
     []
x =
     1
>> testpersist
x =
     []
x =
     1


*2nd test, "clear('functions')" is commented out, two consecutive calls*
+verbatin+
>> testpersist
x =
     []
x =
     1
>> testpersist
x =
     1
x =
     1

*3rd test, two consecutive calls -- first with "clear(.." commented out,
second with uncommented "clear(.."
+verbatin+
>> testpersist
x =
     []
x =
     1
>> testpersist
x =
     []
x =
     1


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35881>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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