OOJ = object oriented J
I have a preexisting verb, for example lets call it myVerb =. +/ % #.
Next I define a class:
coclass 'MyClass'
create =: verb define myValue =: ". y
)
So, essentialy my value is going to run the command y, using verb ".
So perhaps I want y to by 'myVerb 1 2 3'
Then, hopefully myValue will be 2.
So I do
myObj =: conew 'MyClass'
create__myObj 'MyVerb 1 2 3'
However, I get a value error for MyVerb. I asusme this is because myVerb was
defined in a different locale.
I then tried create__myObj 'MyVerb_z_ 1 2 3'
Which also gives a value error.
By the way, what I am trying to do is pass a callback to the constructor of
MyClass, so I can execute an arbitrary function. I am using ". to call the
arbitrary function. I think this method of callbacks was shown in J for C.
So the question is, what is my code doing wrong?
Thanks.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm