Dear list,

having a script file A.ijs with the contents

a =. 1
f1 =. a&+
f2 =. 3 : 0
a&+y
)
f1 0
f2 0

and loading it with

a =. 2
loadd'A.ijs'

I see that the value 1 of 'a' is used for f1, but a value of a *global*
variable 'a' is used for f2. This bothers me a lot. Hence just by
changing from a tacit to explicit form can lead to a surprise.

I eventually found a mention of a similar effect in 'Learning J', but I
do not understand why it has been designed this way...  So what is the
way to have local variables (ie, with the scope of a script file) that are
visible (as if globals) to the functions within the script? Does one
have to create a locale to this end?

Thanks for any comments and explanations.


Best regards
Ruda
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to