JBreak: force J to stop executing the current process
If J appears to "freeze" (e.g. by executing a very long loop) JBreak provides you a way to force J to stop what it is doing and issue a prompt for new input.
JBreak is a separate program (i.e. application), distinct from the J IDE itself.
- In Windows it is a desktop or Start menu item with the "yellow J" icon.
- On the Apple Macintosh it is a separate app having the "yellow J" icon. Its usual position is in the Dock.
Clicking this item when J is running puts J into attention state. In attention state, J will signal an attention-interrupt error on the next sentence started from an explicit definition.
Technically speaking, this is a bona-fide J error, but it is not an error of program logic since it can only arise via deliberate action by the end-user.
Attention state may not be enough to break into the program:
- the program may be looping in a tacit definition and it never gets to executing a next sentence
- the attention-interrupt error may have been intercepted by a try. block or a u :: v verb that cleared the error
If clicking JBreak does not break into your program, click it a second time. This will enter break state. Break state will forcibly terminate the current sentence with a break error.
There are a few places in the J Interpreter where checking for break state would be intolerably expensive. Lookups using the i.-family are the most common. If you get into a very long search primitive, it will have to finish before the break request is honored.