|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-10 21:32:26
|
On Tuesday 10 November 2009 13:00:16 Hans-Bernhard Bröker wrote:
> This one deserves generalization. Unless I missed something, we
> currently don't have a command to get rid of any variable (short of
> 'exit' and starting a new session),
Yeah, we do. You can
undefine VARNAME
But it doesn't take wildcards.
Perhaps it should do the same as the "show var PREFIX" command,
and treat the string as a leading prefix to the full variable name.
> whereas the number of variables we
> have gnuplot create by itself seems to be increasing all the time (first
> "fit" results, then GPVAL_*, now possibly GPSTAT_*).
>
> I think a generic
>
> unset variable {<name>| pattern <regex> | fit | stats}
>
> command would be in order. I would prefer 'unset' over 'reset' here
> because it matches 'show variables' a bit better than 'reset'.
Hmm. But it isn't "set var foo", it's "var = foo".
So "unset" is misleading.
> It should probably be extended to user-defined functions, too.
Yes. Good point.
But there is a possible "gotcha". If you undefine a function that is
called by another previously-defined function, bad things could happen.
> And maybe
> we should even allow
>
> set variable <var>=<expr>
> and
> set function <name>(<arguments>)=<expression>
>
> as an optional syntax instead of the usual <var>=<expr> etc., too.
Yes, that would be the other way to justify use of "unset" :-)
But it seems a more drastic change than extending "undefine".
--
Ethan A Merritt
|