The interpreter works as expected.  The relevant point are:

a. "load" is an explicit defn.  This can not be determined
from first principles but instead by inspection of the
definition of "load".

b. =. in explicit defn assigns to a local name.

c. Global assignment to a local name is not permitted.

I should add that in your examples the use of locales
and the use of the script created by 0 : 0 have no effect 
on the behaviour.



----- Original Message -----
From: bill lam <[EMAIL PROTECTED]>
Date: Tuesday, August 7, 2007 9:35
Subject: [Jprogramming] local and global assignment in different locales
To: Programming forum <[email protected]>

> similar to that reported by Norman Drinkwater, I found that 
> global and local 
> assignment in different locales interference with each other.
> 
> I put the following in 1.ijs and 2.ijs, and run it from menubar 
> run | window
> 
> NB. 1.ijs
> sc_z_=: 0!:100
> coclass 'base'
> 4!:55 <'foo'
> foo=. 123
> 18!:55 <'tmp'
> sc_tmp_ 0 : 0
> foo=: 456
> )
> 
> NB. 2.ijs
> coclass 'base'
> 4!:55 <'foo'
> foo=. 123
> 18!:55 <'tmp'
> coclass 'tmp'
> foo=: 456
> 
>     load 'c:\home\bill\j601\temp\1.ijs'
> |domain error: sc_tmp_
> |   foo    =:456
> |[-0]
> 
>     load 'c:\home\bill\j601\temp\2.ijs'
> |domain error: script
> |   foo    =:456
> |[-6] c:\home\bill\j601\temp\2.ijs
> 
> 
> but if the line foo=. 123 changed to foo=: 123 or commented, it 
> run without error.
>     foo_tmp_
> 456
>     foo_base_
> 123
> 
>     9!:14''
> j601/2006-11-17/17:05
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to