On Thu, 13 Sep 2007, Sven Schreiber wrote:
andreas.rosenblad(a)ltv.se schrieb:
> Why not just change the name of the gamma function from "gamma" to
> "gammafunction" or "gammaf" or something like that?
>
Because it would break existing code.
I agree with a few extra remarks.
The gamma function is not terribly useful, by itself. Its logarithm is.
One possibility would be to remove the gamma() function altogether and
have users use exp(lngamma(x)) if they need to. Of course this would be
quite expensive computationally, but in my experience it is extremely rare
to use the gamma function instead of its logarithm in iterative
computations. Similar considerations hold for the beta function.
The backward compatibility issue could be mitigated by officially
deprecating the use of the gamma function, for instance producing a
warning each time it is used, with an eye to removing it in a year's time
or so.
As for the more general point about namespaces: a possible source of
confusion could come from using functions as function parameters. In the
future, it's not unlikely that we may add a "function" type to the
possible parameter type that may be fed into user-written functions.
For instance, numerical integration. Imagine you have something like
function numint(function f, scalar a, scalar b)
scalar dx = 0.01*(b-a)
scalar ret = 0
scalar x0 = a + 0.5*dx
loop 100 --quiet
ret += f(x0) * dx
x0 += dx
end loop
return scalar ret
end function
Thanks to Allin's foresight, the fact that user-defined functions in gretl
are "strongly typed" does help quite a lot here, but still I imagine that
the code to handle a case like this would be quite complex.
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti