octave-maintainers
[Top][All Lists]
Advanced

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

Compatibility considerations of "clear"


From: Philipp Kutin
Subject: Compatibility considerations of "clear"
Date: Wed, 14 Aug 2013 18:17:46 +0200

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


reply via email to

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