Rewriting scripts and then invoking them with 0!:0 noun (instead of file) has 
the disadvantage of "breaking" 4!:4.  If 4!:4 is ever used on a definition from 
the file, it will report _1 (definition not from a script).  This applies to 
definitions inside the original file, often used to find the directory of the 
program, and used to load related files and data.
The perfect solution is to add an optional left argument to 0!:n noun which 
would be the filename returned by 4!;4 for definitions inside that noun.
A solution I can do myself, applies if the only real use for 4!:4 is in fact to 
find "MYFILE" in a script.
The solution is to replace in the file all top level instances of lines 
starting with (space intollerant)
MYDIR =:MYFILE =: (NB. not sure if this is needed, as the file is usually 
obtained just to get MYDIR)
with a hardcoded string derived from what the x argument (MYFILE) to 0!:n  
should be.
If this function over-rode the load command, then 4!;4 would return empty for 
most definitions, which is only a problem if 4!:4 is ever used for anything 
other than on a variable within its own script .
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to