bugGNU Octave - Bugs: bug #53565, Implement clearvars function for...

 
 

bug #53565: Implement clearvars function for Matlab compatibility

Submitter:  Ceral Paquet <octavebugs>
Submitted:  Thu 05 Apr 2018 04:24:16 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 06 Dec 2018 04:13:44 PM UTC, comment #7: 

I'm not sure what the record is for the oldest bug that has now been cleared.  The original clearvars request goes back to 2013.  I just happened on it because I was looking for bugs with submitted patches ahead of the 5.0 release.  I was hoping that I might find some easy additions to Octave.  This one turned out to be quite a bit of work, however.

Rik <rik5>
Group administrator
Thu 06 Dec 2018 05:02:26 AM UTC, comment #6: 

OK great I guess. Any reason to reimplement this?

if !Rik
   pause(intmax);
   return(complaints);
else
   accept();
endif

;)

Trying to be funny... but srlsy?

Ceral Paquet <octavebugs>
Wed 05 Dec 2018 06:32:57 PM UTC, comment #5: 

I implemented the clearvars function in an m-file in this changeset (https://hg.savannah.gnu.org/hgweb/octave/rev/96bc9ee8e77f).

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Wed 05 Dec 2018 05:20:55 AM UTC, comment #4: 

I improved the input validation of clear to reject multiple options.  I also changed the documentation to state that all options must appear before any name patterns.  The code


a1=1; a2=2; a3=3;
clear a* -x a1


is incorrect.  Once option processing has stopped all remaining items on the line are treated as patterns.  The code above would try to remove a variable named "-x".

See cset https://hg.savannah.gnu.org/hgweb/octave/rev/096b38cac97f.


Rik <rik5>
Group administrator
Wed 05 Dec 2018 05:05:35 AM UTC, comment #3: 

I closed bug #40095 as a duplicate of this one.

Rik <rik5>
Group administrator
Fri 06 Apr 2018 06:28:05 PM UTC, comment #2: 

So should we close bug #40095 as a duplicate of this now?

Mike Miller <mtmiller>
Group Member
Fri 06 Apr 2018 07:14:24 AM UTC, comment #1: 

Oops, didn't post the "clear -x" issue.


>> a1=1; a2=2; a3=3;
>> clear -x a1
>> whos
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
        a1          1x1                          8  double

Total is 1 element using 8 bytes

>> a1=1; a2=2; a3=3;
>> clear a* -x a1
>> whos
>>


If I understand correctly, the exclusive option (-x) should protect a1 so it isn't behaving correctly (or giving an error) when other arguments are supplied.


Ceral Paquet <octavebugs>
Thu 05 Apr 2018 04:24:16 PM UTC, original submission:  

This is a reboot of bug #40095 which is not active. Please find attached a working version of clearvars and test cases.

Ceral Paquet <octavebugs>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #43810:  clearvars.m added by octavebugs (3KiB - text/x-objcsrc)
file #43811:  test_clearvars.m added by octavebugs (1KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by octavebugs (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-05 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2018-12-05 rik5 Summaryclear -x and clearvars revisit Implement clearvars function for Matlab compatibility
    2018-04-06 mtmiller CategoryNone Octave Function
        Item GroupNone Feature Request
        StatusNone Patch Submitted
    2018-04-05 octavebugs Attached File- Added clearvars.m, #43810
        Attached File- Added test_clearvars.m, #43811

    Back to the top

    Powered by Savane 3.13-6ae7.
    Corresponding source code