Hi Jon,

On the chance that you have not yet gone through the labs on Locales and Object 
Oriented Programming, you may find clarity in some of the examples that they 
provide. The Locales lab would be the first one to explore as it provides a 
good foundation for the content of the Object Oriented Programming lab.

Hope this helps.

Cheers, bob

On Sep 15, 2014, at 7:38 AM, Jon Hough <[email protected]> wrote:

> 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

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

Reply via email to