I have reviewed this msg and Raul's msg.  I will 
reply separately to Raul's msg.

A few relevant points:

a. 0!:0 does not create a local symbol table.
The only thing that does is explicit defn.

b. An undefined name is assumed to be a verb.

c. The nameclass of a word may not change
from being a verb/adv/conj to another class,
once that word is put on the parser stack.

>    0!:0 't=. 1+1'   NB. immediate session
>    t
> 2

Nothing wrong here.  0!:0 does not create a 
local symbol table and so when the script finishes 
the name t remains.

>    erase nl''
> 1

Now t is erased.

> NB. strange (not a value error)
>    3 : 't [ 0!:0 ''t=. 1+1'' ' 0
> |domain error: t
> |       t[0!:0't=. 1+1'

In the sentence
   t [ 0!:0 't=. 1+1'
the nameclasses of the words are:
   t      [     0     !:    0    't=. 1+1'
   verb0 verb1 noun0 conj0 noun1 noun2
In particular, the initial t is a verb because
an undefined name is assumed to be a verb.
The parse is as follows:

queue   stack

t       [     0     !:    0     't=. 1+1'
verb0   verb1 noun0 conj0 noun1 noun2

t       [     0!:0  't=. 1+1'        row "4 Conj"
verb0   verb1 verb2 noun2

        t     [     0!:0  't=. 1+1'  no applicable row
        verb0 verb1 verb2 noun2      move from queue

        t     [     i.0 0            row "1 Monad"
        verb0 verb1 noun3

        t     i.0 0                  row "1 Monad"
        verb0 noun4

        t     i.0 0                  row "1 Monad"
        verb0 noun4

In the last parser action the interpreter
finds that the nameclass of t has changed
from verb to noun, and signals an error.
A simpler demonstration of the same effect is
undef ". 'undef=. 1'

> NB. unlike a true value error
>    3 : 'z [ 0!:0 ''t=. 1+1'' ' 0
> |value error: z
> |       z[0!:0't=. 1+1'

z is undefined and assumed to be a verb.
In a parse similar to the preceding,
it comes down to   z i.0 0 .  When the
interpreter tries to find the defn of
the verb z it finds none, and signals
value error.

> NB. at the same time, it is listed as noun
>    3 : 'nc<''t'' [ 0!:0 ''t=. 1+1'' ' 0
> 0

t is indeed a noun.

>    3 : 'nc<''z'' [ 0!:0 ''t=. 1+1'' ' 0
> _1

z is indeed undefined.

> NB. moreover it is blocking =:
>    3 : 't [ 0!:0 ''t=: 1+1'' [ t=.3 ' 0
> |domain error
> |   t    =:1+1
> |[-0] 

The t=.3 is evaluated inside an explicit defn
and so is a local assignment.  The subsequent
t=:1+1  is correctly a domain error because
global assignment to a local name is not
permitted.

> NB. no effect of =. in 0!:0 if defined earlier
>    3 : 't [ 0!:0 ''t=. 1+1'' [ t=. 3' 0
> 3

The leftmost t is stacked as a noun.



----- Original Message -----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
Date: Monday, August 6, 2007 17:07
Subject: Re: [Jprogramming] Standalone Error wdhandler_base_
To: Programming forum <[email protected]>

> Interesting, there is something strange happening
> between script (0!:0) and explicit (3 : '') contexts.
> See *).
> 
>    0!:0 't=. 1+1'   NB. immediate session
>    t
> 2
>    erase nl''
> 1
> 
> NB. strange (not a value error)
>    3 : 't [ 0!:0 ''t=. 1+1'' ' 0
> |domain error: t
> |       t[0!:0't=. 1+1'
> 
> NB. unlike a true value error
>    3 : 'z [ 0!:0 ''t=. 1+1'' ' 0
> |value error: z
> |       z[0!:0't=. 1+1'
> 
> NB. at the same time, it is listed as noun
>    3 : 'nc<''t'' [ 0!:0 ''t=. 1+1'' ' 0
> 0
>    3 : 'nc<''z'' [ 0!:0 ''t=. 1+1'' ' 0
> _1
> 
> NB. moreover it is blocking =:
>    3 : 't [ 0!:0 ''t=: 1+1'' [ t=.3 ' 0
> |domain error
> |   t    =:1+1
> |[-0] 
> 
> NB. no effect of =. in 0!:0 if defined earlier
>    3 : 't [ 0!:0 ''t=. 1+1'' [ t=. 3' 0
> 3
> 
> 
> ______________
> *) I believe, it can be assumed that the following
> have the same effect:
>    0!:0 ] 1!:1 <'test1.ijs'
>    0!:0 <'test1.ijs'
> so we can just use instead:
>    0!:0 'contents of script file (test1.ijs) here'
> For example,
>    0!:0 'smoutput 1',LF,'smoutput 2'
> 1
> 2
> 
> 
> --- "N. Drinkwater" <[EMAIL PROTECTED]> wrote:
> 
> > I've found that a conflict between local variables in some of 
> the 
> > library scripts and global variables in application scripts 
> will cause 
> > an error when the standalone script is started from the 
> command-line. No 
> > error occurs when using 0!:0 from minijx.
> > 
> > For example, stdlib.ijs contains the following lines:
> > 
> > t=. <;._1 '/invalid name ...
> > type=: {&t@(2&+)@(4!:0)&boxopen
> > 
> > (note that the line t=. is truncated above)
> > 
> > The local assignment in stdlib will cause a crash when a stand-
> alone 
> > application is built for the following script:
> > 
> > NB. testerr.ijs
> > coclass'test'
> > t=: 1
> > test=: 3 : 0
> > wd'mb "J" "hello world"'
> > )
> > cocurrent'base'
> > test''
> > 
> > The local assignment causes a problem even though the global 
> assignment 
> > is in a different locale. The above will work fine from the J 
> session 
> > manager or when loaded using 0!:0 in the minimal J window 
> given by 
> > running j.exe -jprofile from the command line. The crash only 
> happens 
> > when using
> > 
> > j.exe -jprofile test.ijs
> > 
> > from the command line, where test.ijs is the stand-alone 
> script. Other 
> > single letter variables that cause the same problem are a, c, 
> d, h, and 
> > j. It took some time to track this problem down the first time 
> my 
> > stand-alone application gave the dreaded "Error and no IDE 
> window for 
> > debugging" dialog. One solution would be to make all of the 
> local 
> > "helper" assignments in the system scripts global assignments.
> > 
> > Norman Drinkwater
> > 
> > 
> > 
> > Chris Burke wrote:
> > > Saunders, John (HMSRHS) wrote:
> > >> Thanks Chris, I now have the script working from the 
> session manager
> > >> loaded without the jprofile by entering 0!:0 
> <'c:\EMA\salaries.ijs'> >> However I can't get it working 
> form a desktop shortcut for some reason,
> > >> I've tried different syntax with no luck for example
> > >> C:\EMA\j.exe -jprofile salaries.ijs
> > >> C:\EMA\j.exe -jprofile \salaries.ijs
> > >> C:\EMA\j.exe -jprofile c:\EMA\salaries.ijs
> > >> I can load  c:\EMA\j.exe - jprofile from the desktop; 
> though can't seem
> > >> to include the script??
> > > 
> > > This does not sound right. Loading J with:
> > > 
> > >   C:\EMA\j.exe -jprofile c:\EMA\salaries.ijs
> > > 
> > > should be essentially the same as loading J with:
> > > 
> > >   C:\EMA\j.exe -jprofile
> > > 
> > > and then entering
> > > 
> > >    0!:0 <'c:\EMA\salaries.ijs'
> > > 
> > > Is the Start In directory set correctly in your shortcut? 
> What error
> > > message do you get?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to