|
From: Philipp K. J. <ja...@ie...> - 2009-11-11 00:57:57
|
On Tuesday 10 November 2009 01:32:06 pm Ethan Merritt wrote:
> 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.
Side question: is that behavior documented
somewhere? I did not know about it, either.
>
> 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.
That's what we were thinking. (I will admit that
I am reluctant to implement a regular expression
parser. It seems like overkill.)
I tend to prefer "unset" over "reset" - simply
because I am already used to "unset" taking
arguments, whereas "reset" does not.
>
> > 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".
|