the 3 lines are:

assign_z_ =: 4 : '(x) =: y' 

OOP_z_ =: <'OOP' 
coclass_z_ =: 18!:4@boxxopen@:[ ((('_OOP_' ,~ 'C' ,  ]) assign boxopen)^:(0 = 
L.))


or the last line can be this instead:

coclass_OOP_ =: 18!:4@boxxopen@:[ ((('_OOP_' ,~ 'C' , ]) assign boxopen)^:(0 = 
L.)) 



coclass is already defined to be the same as cocurrent.

what the new definition does is add a noun into the OOP locale that is the name 
of the class with a 'C' prepended, and simply contains the boxed name of the 
class.

There is a small consistency advantage from a single ( __ ) accessor syntax, 
but the big benefit is:

coclass 'myclass'  NB. or coclass__OOP 'myclass' with alternative definition.
obj1 =: 18!:3 ''
plus__obj1 =: +
coclass 'base'


plus__obj1 
|value error: obj1

plus__obj1_myclass_ 
|ill-formed name: plus__obj1_myclass_ 


plus__obj1__Cmyclass__OOP 
+ 


or with 

coinsert 'OOP' 
plus__obj1__Cmyclass 
+ 

The benefit is accessing any hierarchy from any other locale directly.  It just 
costs a small string in an out of the way locale.

A reason to prefer the 2nd syntax is that you can avoid the small cost by just 
using the coclass__OOP explicit alternate invocation for just the classes you 
would like outside access to, (though you can still avoid creating the accessor 
by using cocurrent instead of coclass).

The reason to prefer the 1st syntax is that you get libraries automatically 
have an accessor, or not change existing code.

names__OOP '' will list all accessor locales, and how big/small you want this 
list could influence your preference.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to