octave-maintainers
[Top][All Lists]
Advanced

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

Re: Bug: clear leaves global variables in symbol table


From: John W. Eaton
Subject: Re: Bug: clear leaves global variables in symbol table
Date: Mon, 8 Jun 2009 09:31:28 -0400

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



reply via email to

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