The behaviour exhibited by your examples can
be explained by the following:

a. A value error is signalled if the definition of 

a verb is needed but that verb is undefined:

   undefined + 1

|value error: undefined

|       undefined+1


b. An undefined name is treated as a verb and,
unless its definition is needed, is not an error:
   3 : ('undefined';'3+4') 5
7

c. A syntax error is signalled if a verb returns 
a verb result.
   3 : ('3+4';'*') 5
|syntax error
|       3 :('3+4';'*')5

p.s. Are you really based in Zambia, or is it just where 
your ISP is located?



----- Original Message -----
From: "Jeff.Mosmann" <[EMAIL PROTECTED]>
Date: Tuesday, April 22, 2008 8:33
Subject: [Jprogramming] try. B0 catch. B1 end.
To: [email protected]

> I have come across a situation where < try. B0 catch. B1 end. 
> > appears to
> behave inappropriately.
> 
>  
> 
> If the rightmost element of B0 is an undefined name, the 
> expected value
> error is not caught, but breaks the control structure with a 
> syntax error.
> 
>  
> 
> If, however, there is another element to the right of the 
> undefined name,
> then the structure behaves as expected and B1 is executed.
> 
>  
> 
> With J602 / Windows XP / Intel Pentium M,
> 
>  
> 
>    case0=: 3 : 'try.  notdefined   
> catch. ''breaks''      end.'
> 
>  
> 
>    case0 ‘’
> 
> |syntax error: case0
> 
> |       case0''
> 
>  
> 
>    case1=: 3 : 'try. 1+ notdefined catch. ''also 
> breaks'' end.'
> 
>  
> 
>    case1 ‘’
> 
> |syntax error: case1
> 
> |       case1''
> 
>  
> 
>    case2=: 3 : 'try.  notdefined +1 catch. ''but 
> this works!'' end.'
> 
>  
> 
>    case2 ''
> 
> but this works!
> 
>  
> 
> Is this a bug?  Or have I missed something ….. ?


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

Reply via email to