June Kim asked:
>  I always have to run it twice to actually 
>  stop the J interpreter. 

>From   http://www.jsoftware.com/help/user/interrupt.htm  :

        One signal stops execution at the start of the next 
        sentence with an attention interrupt. Two signals 
        stops execution in the middle of a sentence with 
        a break.   

        It is better to use a single signal to get an attention
        interrupt as the state of execution at the start of a
        line is clear.  In a break it is not clear what has 
        been executed and there is some chance of crash as it 
        is difficult to ensure a clean state in all cases.  
        Wait several seconds before getting impatient and 
        giving the second signal.

So, in your case, you require two signals because you do not want to wait for 
the current sentence to stop executing.  You want to interrupt the currently 
running sentence.

The question for the implementors is:  how is  break  implemented (the 
implementation of attention interrupt is obvious)?  When does the interpreter 
check the value of the break flag, such that jbreak can interrupt a running 
sentence?

Is it checked within every primitive?  Is it after every primitive, and only 
within certain primitives?   If so, which primitives (e.g. power, rank, scan, 
etc), and at what times?  Is it possible, for example, to break  +  in the 
middle of the creation of a large sum array, such that the array is only "half 
built", and is subsequently discarded?

-Dan

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

Reply via email to