to narrow the bug down, it seems to apply just to script files with definitions entered under cocurrent: (even when explicitly named with locale outside it.). Bug applies to j8 and j7.
continuing previous example: b =: conew 'cat' a__b 2 >: conj__b ] 1 3 updated code file: cocurrent 'myl' a=: 4 c =: 2 : 0 smoutput 18!:5 '' u a v y ) v =: 4 : 0 smoutput 18!:5 '' x + y ) cocurrent 'base' c2_myl_ =: 2 : 0 smoutput 18!:5 '' u a v y ) c =: conew 'myl' a__c 4 +: c__c + 3 ┌────┐ │base│ └────┘ 20 NB. wrong a=7 from base used instead of 4. +: c2__c + 3 ┌────┐ │base│ └────┘ 20 +: c2_myl_ + 3 ┌────┐ │base│ └────┘ 20 ----- Original Message ----- From: Pascal Jasmin <[email protected]> To: "[email protected]" <[email protected]> Cc: Sent: Saturday, November 16, 2013 9:22:17 PM Subject: Re: [Jprogramming] bug in conjunction locales? when I define these in j8 repl, it works as I'd want conj_cat_=: 2 :'v@:u^:a' >: conj_cat_ ] 1 9 >: ^:8 ] 1 9 this is also the 'right' answer: >: conj_cat_ ] a 15 >: ^:8 ] 7 15 a_cat_=: 2 >: conj_cat_ ] a 9 The issue is entirely related to accessing variables at time of definition. > I think you have said that the value of 'a' should be 8 because itmakes no > sense for it to be 5. But, it's actually 9. The a accessed in verb_dog_ should indeed be 9. For definitions entered in J7 files within a cocurrent context, the locale for a conjunction is wrong... it is the callers. It is correct for a verb. ----- Original Message ----- From: Raul Miller <[email protected]> To: Programming forum <[email protected]> Cc: Sent: Saturday, November 16, 2013 8:52:16 PM Subject: Re: [Jprogramming] bug in conjunction locales? What do you mean by "execute"? Consider this example: a_cat_=: 8 a_dog_=: 9 a=: 7 conj_cat_=: 2 :'u&.(v inv)' verb_dog_=: do bind 'a' thingy=: verb_dog_ conj_cat_ % thingy 5 I think you have said that the value of 'a' should be 8 because it makes no sense for it to be 5. But, it's actually 9. Conceptually speaking, conjunctions are executed multiple times - they have both "parse time" and "execution time" semantics. And, given your logic, I think you are talking about their "parse time behavior", not their "execution time behavior". Does this distinction sound meaningful to you? Thanks, -- Raul On Sat, Nov 16, 2013 at 6:25 PM, Pascal Jasmin <[email protected]> wrote: > I feel as though conjunctions defined inside a locale should have their > current locale state when executed be that locale. It makes no sense for it > to be the caller's. > > The reason it is a big issue is that the conjunction may wish to access > member data. > > > cocurrent 'myl' > > c =: 2 : 0 > smoutput 18!:5 '' > u v y > ) > > v =: 4 : 0 > smoutput 18!:5 '' > x + y > ) > > > 3 v_myl_ 2 > ┌───┐ > │myl│ > └───┘ > 5 > +: c_myl_ +: 2 > ┌────┐ > │base│ > └────┘ > 8 > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
