octave-maintainers
[Top][All Lists]
Advanced

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

Re: Compatibility considerations of "clear"


From: Julien Bect
Subject: Re: Compatibility considerations of "clear"
Date: Thu, 15 Aug 2013 12:16:30 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8

On 14/08/2013 18:24, Ben Abbott wrote:
On Aug 14, 2013, at 12:17 PM, Philipp Kutin wrote:

In Octave, issuing a plain "clear" clears both workspace and global
variables. This is a little surprising to someone working with MATLAB,
but from the command line it's only a minor issue. However, it may
have compatibility implications when used from a function.

There does exist M code in the wild that calls "clear"
programmatically. I guess that it's mostly people feeling clearing
data manually sometimes, but occasionally, it can be justified. For
example, when reading in some large data and reordering it to
normalize to one's convention -- it may be a sensible move to clear a
temp variable before the function returns if further memory-intensive
operations are subsequently carried out.

I propose making plain "clear" only clear the workspace-local
variables, and adding an option "-a"/"-all" for the current behavior.
What do you think?

--Philipp
 From Matlab ...

-----------
If X is global, clear X removes X from the current workspace, but
leaves it accessible to any functions declaring it global.
clear GLOBAL X completely removes the global variable X.
clear GLOBAL -REGEXP PAT removes global variables that match regular
expression patterns.
-----------

Octave is intended to be compatible with Matlab, so this is a bug.  Would you 
file a bug report?

        https://savannah.gnu.org/bugs/?group=octave

Ben

I did  : https://savannah.gnu.org/bugs/index.php?39790

Julien.



reply via email to

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