I can't explain any of your results, but I note that on
my system I get the value error on y only when the verb is
assigned to a name:

   xx =: 3 :'y=.y,y'
|value error: y
|   xx=:    3 :'y=.y,y'
   3 :'y=.y,y'
3 : 'y=.y,y' 

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron
> Sent: Wednesday, May 03, 2006 3:56 PM
> To: Beta Forum
> Subject: [Jbeta] Bug report: Spurious value error on verb 
> definition(containing append in place pattern)
> 
> Spurious value error in J6.01 betas:
> 
>          4 : 'x =. x , y'
>       4 : 'x =. x , y'
>       |value error: y
>       |       4 :'x =. x , y'
> 
> A simpler example is just  3 :'y=.y,y'  .  Note that even 
> though the error is thrown, the verb is still returned.
> 
> I was writing a verb that accumulates data in a global buffer 
> (because it's called asynchronously).  If I don't define 
> (assign to) the buffer before I define the verb in the 
> script, I get the spurious error:
> 
>          _1 -: nc {.;:'BUFFER'  NB.  BUFFER  is undefined 
>       1
> 
>          async =: 3 : 'BUFFER =: BUFFER , y'
>       |value error: y
>       |   async=:    3 :'BUFFER =: BUFFER , y'
> 
> 
>          async   NB.  Verb was still assigned
>       3 : 'BUFFER =: BUFFER , y'
>          
> I think this is related to the new append-in-place smarts, 
> because other forms don't trigger the bug:
> 
>          v0 =: 3 : 'y'
>          v1 =: 3 : 'BUFFER , y'
>          v2 =: 3 : 'BUFFER =: y'
>          v3 =: 3 : 'BUFFER =: BUFFER , y'
>       |value error: y
>       |   v3=:    3 :'BUFFER =: BUFFER , y'
>          v4 =: 3 : 'BUFFER =: y , BUFFER'
>          v5 =: 3 : 'BUFFER =: BUFFER , BUFFER'
>       |value error: BUFFER
>       |   v5=:    3 :'BUFFER =: BUFFER , BUFFER'
>          v5 =: 3 : 'BUFFER =: BUFFER , 0'
> 
> Note (from second transcript) that even if the spurious error 
> is thrown, the verb still gets defined.   If this verb is 
> invoked, another surprise occurs:
> 
>          async 'hello'
>       |domain error: async
>       |   BUFFER=:BUFFER    ,y
> 
> Why is this a domain error?  I expect a value error.
> 
>   BUFFER  is an undefined name, so it should be treated as a 
> verb.  If   BUFFER  were really a verb, it would be invoked 
> monadically with the argument  ,y  (the ravel of  y  ), the 
> result of which would then be assigned to   BUFFER  , 
> changing its nameclass to noun.  But, since  BUFFER  is not 
> defined, I expect that monadic invocation to fail with a value error.
> 
> I would expect a domain error if I invoked  v4 'hello'  
> because of J6's new NVV train (meaning v4 would try to return 
> a verb), but that's not the case in  async  .
> 
> Is this a bug?  I hesitate to assert so because whenever I 
> report a "misspelled error" I'm told it's not a bug.  But consider:
> 
>          _1=nc ;:'BUFFER OTHER'  NB. Both undefined
>       1 1
>          3 : 'BUFFER , 22' 0
>       |value error: BUFFER
>       |       BUFFER,22
>          3 : 'OTHER =: BUFFER , 22' 0
>       |value error: BUFFER
>       |   OTHER=:    BUFFER,22
>          3 : 'BUFFER =: OTHER , 22' 0
>       |value error: OTHER
>       |   BUFFER=:    OTHER,22
>          3 : 'BUFFER =: BUFFER , 22' 0
>       |domain error
>       |   BUFFER=:BUFFER    ,22
> 
> If it's not a bug, I would appreciate an explicit explanation 
> of the reason.
> 
> -Dan
>         
> ----------------------------------------------------------------------
> 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