diff libinterp/corefcn/variables.cc @ 28505:a39a46b4cd4e

maint: Merge stable to default.
author Rik <rik@octave.org>
date Fri, 26 Jun 2020 13:57:24 -0700
parents 376ca9022b7e d747d57989e2
children 4e10e25f0fc6
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Thu Jun 25 18:20:03 2020 -0700
+++ b/libinterp/corefcn/variables.cc	Fri Jun 26 13:57:24 2020 -0700
@@ -1124,7 +1124,7 @@
 @deftypefn  {} {} clear
 @deftypefnx {} {} clear @var{pattern} @dots{}
 @deftypefnx {} {} clear @var{options} @var{pattern} @dots{}
-Delete the names matching the given @var{pattern}s from the symbol table.
+Delete the names matching the given @var{pattern}s thereby freeing memory.
 
 The @var{pattern} may contain the following special characters:
 
@@ -1192,7 +1192,7 @@
 @option{-exclusive}, only one other option may appear.  All options must
 appear before any patterns.
 
-Programming Note: The command @code{clear @var{name}} only clears the variable
+Programming Notes: The command @code{clear @var{name}} only clears the variable
 @var{name} when both a variable and a (shadowed) function named @var{name}
 are currently defined.  For example, suppose you have defined a function
 @code{foo}, and then hidden it by performing the assignment @code{foo = 2}.
@@ -1200,7 +1200,13 @@
 definition and restore the definition of @code{foo} as a function.
 Executing @code{clear foo} a second time will clear the function definition.
 
-@seealso{who, whos, exist, mlock}
+When a local variable name, which is linked to a global variable, is cleared
+only the local copy of the variable is removed.  The global copy is untouched
+and can be restored with @code{global @var{global_varname}}.  Conversely,
+@code{clear -g @var{global_varname}} will remove both the local and global
+variables.
+
+@seealso{clearvars, who, whos, exist, mlock}
 @end deftypefn */)
 {
   int argc = args.length () + 1;