Yes.  inspection convenience from base and other locales by autocreating an 
accessible name.


----- Original Message -----
From: bill lam <[email protected]>
To: 'Pascal Jasmin' via Programming <[email protected]>
Cc: 
Sent: Tuesday, June 9, 2015 11:34 PM
Subject: Re: [Jprogramming] a 3 line file that improves OOP programming

I see, so it is another way to do,

c=.'<'myclass'
plus__obj1__c

Ср, 10 июн 2015, jprogramming написал(а):
> a =. conew 'myclass' 
> plus__obj1__a 
> + 
> 
> 
> 
> 
> ----- Original Message -----
> From: bill lam <[email protected]>
> To: Programming forum <[email protected]>
> Cc: 
> Sent: Tuesday, June 9, 2015 11:14 PM
> Subject: Re: [Jprogramming] a 3 line file that improves OOP programming
> 
> I do not understand enough, what if an object is created using conew
> 'myclass', how will you reference plus__obj1 in that case?
> On Jun 10, 2015 10:54 AM, "'Pascal Jasmin' via Programming" <
> [email protected]> wrote:
> 
> > 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
> 
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3

----------------------------------------------------------------------
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