I managed to find another way to crash J. I'm not sure whether the fault
lies in J itself or in Qt, but... here's the story:

When J is running on something that takes a long time (for example,
fetching hundreds of files, each fetched file requiring its own shell
command), it would be nice to let the user know that J is doing what it is
supposed to. Users know that computers sometimes have problems, and they
like having a mechanism to distinguish between failure and functioning
modes of operation. And while jconsole has a nice mechanism for this
(smoutput), jqt does not share this behavior.

So, I thought, let's introduce a small delay between statements, so that
the display can update and the user can see something happening.

Thus:

Progressively=:1 :0
  0 u Progressively y
:
  wd 'timer 0'
  smoutput u x{y
  next=.x+1
  if. next<#y do.
    sys_timer_z_=: next u Progressively y"_
    wd 'timer 1'
  end.
)

But when I go to try it out, I got a syntax error while trying to update
sys_timer_z_ when it is on the stack. (Shouldn't that be a stack error, if
it needs to be an error at all?)

And when I tried to reproduce that syntax error with debugging enabled, so
I could see what was going on, I crashed J.

Here's my test case:
   *: Progressively 2 3 5 7 11

My suspicion is that I've violated some assumptions made during memory
management. And, indeed, a rewritten version of the code seems to work fine:

Progressively=:1 :0
  sys_timer_z_=: do_base_ bind 'N U Progressively Y'
  N=:0
  U=:u
  Y=:y
  0 u Progressively y
  wd 'timer 1'
:
  wd 'timer 0'
  smoutput u x{y
  if. (x+1)<#y do.
    N=:x+1
    wd 'timer 1'
  else.
    smoutput '   ' NB. re-issue prompt
  end.
)

But I thought I should report the bug, in case someone else can get around
to isolating and fixing it before me. (I'm playing with the source version
of J but proceeding very slowly.)

(Also, of course, feel free to use the working version of 'Progressively',
if you have need of something like that.)

Thanks,

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

Reply via email to