octave-maintainers
[Top][All Lists]
Advanced

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

Possible scoping bug with scripts


From: Jason Riedy
Subject: Possible scoping bug with scripts
Date: Mon, 23 Mar 2009 15:54:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

With a script foo.m that contains only:
  exist ("bar", "var")
running
  octave -q --eval 'bar = 1; foo'
says bar doesn't exist.  As do
  octave -q --eval 'bar = 1; source ("foo.m")'
and
  octave -q --eval 'bar = 1' foo.m

This is with an Octave build from a few days ago.

Is this intended?  I honestly don't know the scoping of scripts,
but the first form above worked at some point in the past few
months.  (I use this form for setting batch job parameters.)

Another odd twist is that globals don't seem to work in the same
circumstance.  Adding a 'global bar;' before 'bar = 1;' and also as
the first line in foo.m makes "bar" exist, but printing it gives
the empty matrix.

Jason


reply via email to

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