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

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

[Octave-bug-tracker] [bug #42883] Various issues relating to the lack of


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #42883] Various issues relating to the lack of re-compilation of .m files changed during script execution
Date: Thu, 31 Jul 2014 16:27:35 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0 Iceweasel/30.0

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

I'll just comment on this since I helped the OP debug this on IRC. I'm not
sure if this is a bug. Matlab's behaviour is weird and possibly not worth
replicating, but we're behaving differently so a discussion may be worth.

In short, the possible issues are:

* entering filename at the prompt behaves different than Matlab. Matlab reads
the file if it has changed less than 1 second ago, Octave never does;

* using run() in Octave will always re-source the file while Matlab behaves
the same as naming file, i.e., re-source if changed less than 1 second ago;

* Octave documentation suggests that run(), source(), and naming file at the
prompt are the same but the rules for re-sourcing the file are different.

With examples:

If you have a m file in the current directory with 'x = 5', and you just enter
the filename at the prompt, you get x on the environment. But if you then
change the file for 'x = 6' and do it again, it will ignore the changes to the
file as can be seen by calling testbug(20):


function testbug (t)
  for z = 1:t
    foo (z);
  end
end

function foo (x)
  bar (x);
  pause (0.1);
  testb;
end

function bar (y)
  m = sprintf('y = [%i]', y);
  system (['echo ''' m ''' > testb.m']);
end


Matlab behaviour seems to check the timestamp of the file (with 1 second
resolution), and re-source the file if it is different. This 1 second time
resolution can lead to weird bugs where for the first 7 iterations prints 1,
then prints 8 for a while, and then 17 until the end.

The behaviour is also different if run() or source() are used. In Octave it
will always re-source the file but in Matlab, run() behaves exactly like just
naming the file at the prompt (note that Matlab does not have source() ).

If we decide against following Matlab's behaviour here, then there's only the
documentation bug of source() and run() which suggests that their usage is the
same as typing the filename at the prompt.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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