octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #40452] explicit clear will not clear function


From: anonymous
Subject: [Octave-bug-tracker] [bug #40452] explicit clear will not clear function entered on the command line
Date: Sat, 02 Nov 2013 12:41:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0 Iceweasel/20.0

URL:
  <http://savannah.gnu.org/bugs/?40452>

                 Summary: explicit clear will not clear function entered on
the command line
                 Project: GNU Octave
            Submitted by: None
            Submitted on: sam. 02 nov. 2013 12:41:06 UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Adrian
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

When I define a function on the command line, I do not seem to be able to
clear it by specifying its name. The only way seems to clear its definition
appears to be clearing everything (clear -a), as the following transcript
illustrates (fresh session with empty .octaverc, on an up-to-date Debian
stable (Wheezy)):


octave:1> exist("foo")
ans = 0
octave:2> function foo "nop"; endfunction
octave:3> exist("foo")
ans =  103
octave:4> clear foo
octave:5> exist("foo")
ans =  103
octave:6> clear -f foo
octave:7> exist("foo")
ans =  103
octave:8> clear
octave:9> exist("foo")
ans =  103
octave:10> clear -a
octave:11> exist("foo")
ans = 0


I don't know whether this is intended behaviour, but the documentation seems
to suggest it is not: "For example, suppose you have defined a function foo,
and then hidden it by performing the assignment foo = 2. Executing the command
clear foo once will clear the variable definition and restore the definition
of foo as a function. Executing clear foo a second time will clear the
function definition."


octave:12> function foo "nop"; endfunction
octave:13> exist("foo")
ans =  103
octave:14> foo=2;
octave:15> exist("foo")
ans =  1
octave:16> clear foo
octave:17> exist("foo")
ans =  103
octave:18> clear foo
octave:19> exist("foo")
ans =  103


Is this a problem of my installation/GNU-Linux distribution/octave version/...
only, or some misunderstanding of the intended behaviour on my side, or indeed
a bug ?

(I also do not seem to be able to type the function's definition ("type foo"
yields "error: type: `foo' undefined"), but this is better submitted as
another bug-report if this one is confirmed to be a bug).





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40452>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

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