octave-maintainers
[Top][All Lists]
Advanced

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

Possible scoping bug with scripts


From: John W. Eaton
Subject: Possible scoping bug with scripts
Date: Mon, 23 Mar 2009 19:32:03 -0400

On 23-Mar-2009, Jason Riedy wrote:

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

No, this is not the intended behavior.  I checked in the following
change:

  http://hg.savannah.gnu.org/hgweb/octave/rev/da58ec8f62e8

Thanks,

jwe


reply via email to

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