[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unclearable global variables?
From: |
pkienzle |
Subject: |
Re: Unclearable global variables? |
Date: |
Fri, 18 Mar 2005 08:17:01 +0000 |
This method has a couple of advantages:
1) the value doesn't get stored during save like
global values do (did?)
2) the values are available without having to
say 'global value'
The second could also be considered a disadvantage,
but in that case namespace support could be added
to octave to address it.
-Paul
> On 18-Mar-2005, address@hidden <address@hidden> wrote:
>
> | The following should work but I haven't tested it:
> |
> | function r=var(x)
> | mlock
> | persistent z = 'default';
> | if nargin, z=x; end
> | r = z;
> | end
> |
> |
> | You can reference it as if it were a variable, e.g.,
> |
> | y = var;
> |
> | but to set it to a new value you need to do
> |
> | var('value')
>
> Maybe we should extend mlock/munlock/mislocked to allow "locking" of
> global variables?
>
> jwe
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------