On Sat, 01 Apr 2006 15:57:03 +0400, Henry Rich <[EMAIL PROTECTED]> wrote:

It looks like an error in the interpreter, but one you can work around.

The interpreter scans the text of the entity looking for the variables
m. n. u. v. m n u v
and if it doesn't find any, it assumes that x and y actually mean
u and v.  It apparently doesn't recognize val__u as being a reference
to u, so it translates x and y into u and v; in a1, for example, this
makes y undefined, because there is no v operand to the conjunction.

Thanks, now I see the real source of problem.

Before J6 you would have had to have a line like
u =. u.
which would alert the interpreter that u. is used.  Now you have
to make sure that u or v appears by itself somewhere in your
entity.  One way is

   a4 =. 1 : 'if. do. u else. y+val__u end.'

It seems that I can use just this:

a2 =: 1 : 'y + val__u [u'
c1 =: 2 : 'y + val__u + val__v [u[v'

Maybe Gosi was right, and we should get rid of the old-form
modifiers for J6.

I for this change too. If J601 is not fully backward compatible with previous version
why it should have staff from oldier versions.
For me it just a source of errors and complexity.
But maybe I'm missing something.

Henry Rich


--
Mikl


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mikl Kurkov
Sent: Saturday, April 01, 2006 6:15 AM
To: [email protected]
Subject: [Jprogramming] val__u in adverb and conjunction

I want to use numbered locale as a parameter for adverb and
conjunction.
But I stucked with problem, that sometimes I'm allowed to use
val__u, and
sometimes not.
I worked out that this can be avoided by assigning u value to
another
local variable.
But I want to understand why it's impossible to just use val__u.

NB. Test code
coclass 'test'
create =: 3 : 'val =: 20'
destroy =: codestroy

cocurrent 'base'
t =: '' conew 'test'
a1 =: 1 : 'y + val__u'
a2 =: 1 : 'y + val__u1 [ u1 =. u'
c1 =: 2 : 'y + val__u + val__v'
c2 =: 2 : 'y + val__u + v'

t a1 10
|value error: y
|       y+val__u

t a2 10
30

(t c1 t) 10
|domain error: c1
|   y    +val__u+val__v

NB. but next is working
(t c2 10) 30
60

NB. and this one works too
c3 =: 2 : 'y + u + val__v'

(10 c3 t) 30
60

NB. but this not
c4 =: 2 : 'y + val__v'
(10 c4 t) 30
|domain error: c4
|   y    +val__v

So can you explain this behaviour
and is it better to avoid using something like val__u in adverbs and
conjunctions?

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

Reply via email to