Roger and Dan, thank you for the scoop on throws.

I have been long time suspicious of the throw situation,
beginning when it required throwing from a nested call.

But here, I tried to use the debugger and it didn't
catch it. The idea of Exceptions (in other languages)
is also that the debugger can catch it at the place 
of throwing.

Because of issues like these, in many scripts where
error raising is necessary, I was routinely using
signal or assert. The advantages are that you can pass
the information (which is extracted in the 13!:11/12);
such exceptions are first class same as other system
errors; they can be caught with the same catch; they
are caught with debugger as errors; does not require a
separate catcht branch; assert is tacit thus showing
error exactly in place where it is raised, not in
nested or outer call.

So signal/assert is much better suited for application
development, whereas throw may have more academic
interest, possibly building controlled interactions 
that need to travel the stack in a certain way.

Looking at JDB, it seems to provide a generic cover
verb "throw", but it looks like it requires setting
FORCETHROW and running a debugger to take effect.
However, even then, when stopped in debugger it says
"Unknown Error" somewhere in "commit" and does not
show a specific place inside where it occurred.

I do not know for sure if switching to asserts would
be beneficial or work at all, but it is strongly
worth considering.




> From: Roger Hui <[EMAIL PROTECTED]>
> 
> I reproduced on my machine the condition you described.
> I executed 13!:11 '' (last error number) ater the session returned 
> to immediate execution:
> 
>   populate 100
> Current 1  Failed  0
> Current 2  Failed  0
> Current 3  Failed  0
> ...
> Current 36  Failed  0
> Current 37  Failed  0
> 
>    13!:11 ''
> 55
> 
> The 55 indicates "throw", which on the face of it
> could be legitimate.  (An uncaught throw returns
> the session to immediate execution.)  Since
> the netflix.ijs script does not contain "throw."
> I assume the throw is generated somewhere
> in the bowels of jdb?
> 
> 
> 
> ----- Original Message -----
> From: Oleg Kobchenko 
> Date: Wednesday, October 22, 2008 0:31
> Subject: [Jgeneral] Verb abruptly ends without error
> To: General forum 
> 
> > Testing a case of JDB
> > 
> >    http://www.jsoftware.com/jwiki/OlegKobchenko/JDB_Netflix
> > 
> > there came a strange situation when a verb abruptly
> > exited without error. The example is easily reproducible
> > using the small script on Wiki.
> > 
> > It looks like a case of stress-testing on J memory system.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



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

Reply via email to