-------- Original-Nachricht --------
Datum: Thu, 19 Nov 2009 09:19:38 -0500 (EST)
Von: Allin Cottrell <cottrell(a)wfu.edu>
An: Gretl development <gretl-devel(a)lists.wfu.edu>
Betreff: Re: [Gretl-devel] saving graphs to icons within functions
On Thu, 19 Nov 2009, Sven Schreiber wrote:
> > I'll have a think about it. But to push the question back: Do we
> > want functions to be able to do this sort of thing? (That is,
> > create named objects in the user's personal namespace without
> > getting the user's explicit consent in the form of assigning a
> > return value.) The question is not mean to be rhetorical; I'm not
> > sure what's right here.
> I agree, it's not clear at all. In a normal function context I'd
> say it's not necessary, because you can run a script and in the
> top-level scope of your script do these "<-" assignments easily
> (gnuplot or model table). The problem arises within the package
> context, where everything is hidden from the user and should
> happen automatically...
> * The main reason I think the functionality is useful is because
> just having the .plt file is not nearly as good as having the
> icon. If I (or a package user) could somehow import the .plt
> file easily into gretl to get an icon with the associated
> possibility of GUI tweaking the graph, then I would probably
> rest the case.
What about the possibility of supplying an optional string
argument? If the user gives a name for the graph, the function
saves it as an icon under that name, otherwise the graph is
This still requires activating the "objectname <-" mechanism
inside functions, but that should be possible.
You mean like
function void myfunc(string plotname)
plotname <- gnuplot <whatever>
string ploticonname = "great plot"
That would be fine I guess, although of course it's abusing the string a little.
It's quite intransparent to the caller that it is actually granting access to the icon
In principle (without saying that I'm suggesting this, just thinking out loud) a new
parameter type would be needed; matrices that are returned from functions are shoved into
the icon view, so are scalars and strings (?). Returned series (or lists of series) are
shoved into the workspace as well. What's missing is the possibility to
"return" a gnuplot plot from a function so that it get's added to the icon
view. Similar for models in the model table.
Let me get back one more time to the other idea: Wouldn't it be nice to be able to
load a .plt file into gretl's icon session view? Maybe then the
adding-to-icon-view-within-functions thing wouldn't be necessary. (Although strictly
speaking they are two different issues.)