Actually, syntax error is one of the easier ones to track down
as it is nearly always a consequence of a verb attempting to
return a non-noun result.



----- Original Message -----
From: Don Guinn <[EMAIL PROTECTED]>
Date: Tuesday, May 6, 2008 16:23
Subject: Re: [Jprogramming] RE: BegQ--Writing files with LFs not CRLFs?
To: Programming forum <[email protected]>

> This kind of error bothers me. Hard to track back to the 
> problem. Below is a
> verb f where z is an undefined name. Easy to happen with a typo.
> 
> f=:4 : 0
> if. x=1
>   do. y
>   else. z
> end.
> )
>    1 f 5 6
> 5 6
>    2 f 5 6
> |syntax error: f
> |   2     f 5 6
>    load 'debug'
>    dbr 1
>    2 f 5 6
> |syntax error: f
> |f[:3]
> 
> In this example the verb is short enough to easily see the 
> problem, but if
> the verb has very many lines it can be frustrating to find. 
> Debug really
> doesn't help that much either. The error is reported on the 
> close paren, so
> somewhere back in the definition of f is the error.
> 
> On Tue, May 6, 2008 at 4:18 PM, Raul Miller 
> <[EMAIL PROTECTED]> wrote:
> 
> > On Tue, May 6, 2008 at 6:14 PM, Dan Bron <[EMAIL PROTECTED]> wrote:
> > > Now, one could argue that "too many arguments" is a domain 
> error in
> > > the sense that it means "there's something wrong with your 
> arguments",> > but that's a stretch (especially given that this 
> condition used to have
> > its
> > > own name:  valence error).
> >
> > I would instead argue that when you define a verb you provide
> > definitions for both the monadic and dyadic case.  With your
> > explicit definition your dyadic definition had an empty domain.
> >
> > This is similar to, but different, from a valence error.
> >
> > A valence error is a parse-time error, which would have meant
> > that your verb did not have a dyadic definition.   That's
> > subtly different (and slighty more complicated, for example [:
> > would need different treatment).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to