The point is, the line

undefinedname

is not an error.  It's just a verb value, and execution
continues.  So there is no error inside the try. .

But when your verb EXITS, its result is the last value,
and that's the verb undefinedname, which generates a
syntax error (invalid return value).

Put a last line of

''

after the catch. and the error should go away.

Henry Rich 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jeff.Mosmann
> Sent: Wednesday, April 23, 2008 8:07 AM
> To: 'Programming forum'
> Subject: RE: [Jprogramming] try. B0 catch. B1 end.
> 
> Roger,
> 
> Many thanks for your prompt response.  As noted by Alain, .za 
> indicates
> South Africa - I am based in Johannesburg.
> Your response explains why different errors would be 
> signalled as a result
> of evaluation of B0 in case0 and case1 on the one hand, and 
> case2 on the
> other.
> What I am still not clear on is why in "try. B0 catch. B1 
> end." the value
> error in B0 in case2 is caught, and the result of B1 is 
> returned, whereas in
> case0 and case1 the syntax error is not caught.  According to 
> the dictionary
> entry ctry.htm  "catch. catches an error in B0".  No mention 
> is made of any
> particular errors that will not be caught.
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
> Sent: Tuesday, 22 April 2008 18:29
> To: Programming forum
> Subject: Re: [Jprogramming] try. B0 catch. B1 end.
> 
> 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.
> > 
> >    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 ….. ?
> 
> No virus found in this outgoing message.
> Checked by AVG. 
> Version: 7.5.519 / Virus Database: 269.23.3/1390 - Release 
> Date: 2008-04-21
> 16:23
>  
> 
> ----------------------------------------------------------------------
> 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