lets define r: as a monad to return a reference to its
right argument, and would display something like:
  r: myvar
'myvar'
A reference would interact normally with most verbs
returning the value of its variable, but with =. and
=: would update the variable pointed to by the
reference.

 i=: 0
 (=: >:) r: i NB. i=: i + 1
1
 i
1

UpdateVar2=: 4 : 0
 x =: y
)
 (r: byref) UpdateVar2 'newvalue'
 byref
'newvalue'

r: could be an adverb or conjunction.
I guess it can be defined now without language support
as long as you are willing to call it with variables
inside quotes.

A more general alternative that has other uses as well
would be a foreign function that can get an argument
name from inside an explicit function:
ref=: 1 : '666!:0 x'
(myfunc myvar) ref 
'myfunc myvar'
This is different than 5!:5 in that in returns the
names of functions instead of their contents.

Some extra applications would be in making decorators.
The Memo class we dicussed last week could be
implemented with locales instead of objects
Anotations and property lists attached to functions
and variables as well (for example to make/process
document ation strings, by providing classification
(meta) data about your functions and data.

An unrelated seemingly small touch that could be
helpful is letting the explicit define process handle
nested definitions by having a definenested enum.
myverb=: monad definenested NB. 3 : 1
  myprivateverb=. 3 : 0

)
))
This could hopefully let us define multiple classes
inside general files, as well as private explicit
verbs only useful in narrow scopes.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to