On Tue, 12 Feb 2008, Sven Schreiber wrote:
I have thought about it a little bit but could only think of a
solution for the builtin functions like the ones you're talking
about: names starting with 'l_' and the like could be made
"semi-reserved" in the manual, explaining that you risk losing
them.
But IMHO the situation is totally different for user-defined
functions: users should not be required to do a risk analysis or
thoroughly study the documentation of a function before playing
around with it.
Just thinking out loud, but here's one possibility: whenever a
function returns a list (I think that's the only case we're
talking about) there's an automatically accepted final string
argument, namely the "basename" for variables in the returned
list, which then (say) get consecutive numeric suffixes.
For example, consider
function foo (series x, int opt)
...
return list xlist
end function
If you called foo as
list mylist = foo(myvar, 4, "myname")
then gretl would intercept the list at return time and name its
members as myname1, myname2 and so on, before they're shifted into
caller space.
One could get fancier by allowing a more flexible naming template
as the extra argument, rather than just a prefix, but that's the
basic idea.
Allin.