Bill Allombert on Sun, 31 Aug 2008 18:29:42 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Readline

Hello Martin,

Thanks for reporting the issues with Vista. I know nothing about
Windows, but I can answer the second part of your mail:

On Sun, Aug 31, 2008 at 05:42:50PM +0200, Martin Larsen wrote:
> In start.txt I have a function myfun with variable declared like this:
> local(myvar);
> This variable should not have any relevance outside myfun, agree?

Not really. local() variables are dynamically scoped, so are visible in
any functions called from myfun:

The following print "7":

myf2() = print(myvar)
myfun(n) = local(myvar); myvar=7;n*myvar;myf2()

Statically scoped variables are available in GP 2.4 only, using my()
instead of local(): The following print "myvar":

myf2() = print(myvar)
myfun(n) = my(myvar); myvar=7;n*myvar;myf2()

> But this variable is not removed from global function (sic) namespace.
> Here is what happens:
> >myvar(n)= n*n
>  ***   unused characters: myvar(n)=n*n

This was a limitation of GP 2.3 which was fixed in GP 2.4. In GP 2.4,
you can replace function with variable and vice-versa.