[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug: clear leaves global variables in symbol table
From: |
Jaroslav Hajek |
Subject: |
Re: Bug: clear leaves global variables in symbol table |
Date: |
Mon, 8 Jun 2009 15:33:07 +0200 |
On Mon, Jun 8, 2009 at 3:31 PM, John W. Eaton<address@hidden> wrote:
> On 8-Jun-2009, Jaroslav Hajek wrote:
>
> | On Sun, Jun 7, 2009 at 12:15 AM, Rik<address@hidden> wrote:
> | > 6/6/09
> | >
> | > In the Mercurial tip, 'clear' by itself should remove both local and
> | > global variables according to the documentation. Instead it only
> | > appears to remove global variables but they still exist according to
> | > 'who global'.
> | >
> | > Code to reproduce:
> | > global abc = 1
> | > who
> | > =>
> | > Variables in the current scope:
> | >
> | > abc ans
> | > ----------------
> | > clear
> | > who
> | > =>
> | > (blank)
> | > ---------------
> | > who global
> | > =>
> | > Global variables:
> | >
> | > abc
> | > ----------------
> | >
> | > The behavior is correct if 'clear -g' is used instead of just 'clear'.
> | >
> | > --Rik
> | >
> |
> | I checked in the following patch:
> | http://hg.savannah.gnu.org/hgweb/octave/rev/3a447ea9e77b
>
> I thnk we still have an incompatibility. Given the function
>
> function f ()
> global x
> x
>
> I think we should see the following behavior:
>
> f
> #=> x = []
> global x
> x = 1
> #=> x = 1
> f
> #=> x = 1
> clear x
> x
> #=> x undefined
> f
> #=> x = 1
> clear functions
> f
> #=> x = 1
>
> (this much is correct now)
>
> clear global
> x
> #=> x undefined
> f
> #=> x = []
>
> but I still see
>
> x = 1
>
> for the value of x inside F, even after the "clear global" command.
>
> I haven't investigated to see why this is happening, or what the fix
> is, but wanted to make a note of it.
>
> jwe
>
Please try
http://hg.savannah.gnu.org/hgweb/octave/rev/73e36b147e45
cheers
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz