The ref and at will work unless f. is applied (but, why?)

   v1=: 'v' at o
   v1
v_11_
   v1 20    NB. invoked from different locale
32

If f. is absolutely necessary than consider f. proof verb:

   fv=: 2 : '3 : ((m ref n),'' y'')'

   'v' fv o
3 : 'v_11_ y'

   ('v' fv o) f. 20
32



--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:

> Why would referencing instance members fail?
> 
>    ref=: 4 : 'x,''_'',(":>y),''_'''
>    at=: 2 : '(m ref n)~'
> 
>    o=. conew 'test'
>    ('a' ref o)
> a_11_
> 
>    ('a' ref o)=: 12
>    ('v' ref o)=: 3 : 'a + y'
>    ('v' ref o)~ 23
> 35
> 
>    ('w' ref o)=: 3 : 'a=: a + y'
>    ('w' ref o)~ 100
> 112
>    ('a' ref o)~
> 112
> 
>    'w' at o 2000
> 2112
>    'a' at o
> 2112
>    
>    'codestroy' at o ''
> 1
>    'a' at o
> |locale error: at
> |       (m ref n)~
> 
> 
> --- Pascal Jasmin <[EMAIL PROTECTED]> wrote:
> 
> > That is very nice solution, and if I had remembered the evoke adverb, I 
> > might have settled for
> > it.  Raul's solution actually generates a verb, and not the string 
> > representation of the
> member.
> >  That is preferable because all callees will know how to execute a verb, 
> > and won't detroy the
> > reference by evoking it.
> > 
> > The other problem is that this technique forces you to write all your class 
> > verbs to take the
> > instance variable as a parameter (x), (so that they are f. proof) because 
> > evoking the string
> > loses the entire context for the function that you normally have if you 
> > called v2__o.  The
> verb
> > v2_3_ will always execute correctly, but if the verb references instance 
> > variables, then as a
> > string, 'v2_3_'~ will fail.
> > 
> > 
> > ----- Original Message ----
> > From: Oleg Kobchenko <[EMAIL PROTECTED]>
> > To: Programming forum <[email protected]>
> > Sent: Monday, October 30, 2006 8:00:32 PM
> > Subject: RE: [Jprogramming]  passing object functions to other objects
> > 
> > Actually if it's just a name generator (like Raul's refname),
> > it can be a dyad, not necessarily a conjunction.
> > 
> >    ref=: 4 : 'x,''_'',(":>y),''_'''
> > 
> >    100 ('v1' ref 'abc')~ ('n1' ref 'abc')~
> > 223
> > 
> > Verb allows additional operations
> > 
> >    ((;:'n2 n3 n4') ref&.> <'abc')=: i.3
> >    ((;:'n2 n3 n4') "[EMAIL PROTECTED]&> <'abc')
> > 0 1 2
> > 
> > 
> > Conjunction is necessary, when a value is deferenced.
> > 
> >    at=: 2 : '(m,''_'',(":>n),''_'')~'
> > 
> >    'n1' at 'abc'
> > 123
> >    100 'v1' at 'abc' 'n1' at 'abc' 
> > 223
> >    
> > This will not allow assignment, but it conceils
> > the redirection.
> > 
> > 
> > --- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> > 
> > > It depends on what class the value of name is:
> > > verbs cannot return verbs. So conjunction is used:
> > > 
> > >    of=: 2 : 'm,''_'',(":>n),''_'''
> > > 
> > >    n1_abc_=: 123
> > >    v1_abc_=: +
> > >    
> > >    'n1' of 'abc'
> > > n1_abc_
> > >    ('n1' of 'abc')~
> > > 123
> > >    
> > >    'v1' of 'abc'
> > > v1_abc_
> > >    ('v1' of 'abc')~
> > > +
> > >    100 ('v1' of 'abc')~ ('n1' of 'abc')~
> > > 223
> > >    
> > >    o=. conew 'ptest'
> > >    ('n2' of o)
> > > n2_1_
> > > 
> > >    ('n2' of o)=: 456
> > >    ('v2' of o)=: -
> > > 
> > >    ('n2' of o)~ ('v2' of o)~ 400
> > > 56
> > > 
> > >    ('codestroy' of o)~''
> > > 1
> > >    n2_1_
> > > |locale error
> > > |       n2_1_
> > > 
> > > 
> > > --- "Miller, Raul D" <[EMAIL PROTECTED]> wrote:
> > > 
> > > > Oleg Kobchenko wrote:
> > > > >What are we trying to achieve here?
> > > > Given a name and a locale, a mechanism to create a reference 
> > > > to the named member of that locale which remains valid in an
> > > > arbitrary locale.
> > > > -- 
> > > > Raul
> > > 
> > > 
> > > 
> > >  
> > > ____________________________________________________________________________________
> > > Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates 
> > > (http://voice.yahoo.com)
> > > 
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > > 
> > 
> > 
> > 
> >  
> > ____________________________________________________________________________________
> > Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates 
> > (http://voice.yahoo.com)
> > 
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > 
> > 
> > 
> > 
> > 
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > 
> 
> 
> 
>  
> ____________________________________________________________________________________
> Get your email and see which of your friends are online - Right on the New 
> Yahoo.com 
> (http://www.yahoo.com/preview) 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 



 
____________________________________________________________________________________
We have the perfect Group for you. Check out the handy changes to Yahoo! Groups 
(http://groups.yahoo.com)

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

Reply via email to