Hi Chris,

Let me try to make the questions more concrete.

Step 0:
===================================
NB. View utils from Learning J
VIEW_z_ =: 3 : '(> ,. ('' =: ''&,)@:(5!:5)"0) nl '''''
view_z_ =: 3 : 'VIEW__lo '''' [ lo =. < y'

Step 1:
===================================
NB. file: c.ijs
coclass 'c'
create =: cocreate
destroy =: codestroy
===================================

Step 11:
===================================
  VIEW_z_ =: 3 : '(> ,. ('' =: ''&,)@:(5!:5)"0) nl '''''
  view_z_ =: 3 : 'VIEW__lo '''' [ lo =. < y'


  load 'c:\myresearch\prog.lang\j\project\dsl\c.ijs'
  o1 =. conew 'c'
  view 'c'
create  =: cocreate
destroy =: codestroy

Step 2:
===================================
NB. direct class creator verb
cc =: 3 : 0
18!:3 <y        NB. create a new boxed locale
create_y_=: cocreate
destroy_y_=: codestroy
conew y
)

Step 21:
===================================
o2 =: cc 'd'
view 'd' NB. ----->> does not show create & destroy verbs
<<-----------------

===========================

(a) relates to why view 'd' does not show the create and destroy verbs that
I have placed in the locale 'd'.

I am exploiting the J's way of creating objects and refactoring them as
execution proceeds.

Regards,
Yuva

p.s:
For (b) Raul has suggested the copath correction. Let me check on that.

And for (c), I found that in LJ there is verb called obcl that lists the
classes & instances. Have to check on that too!
obcl =: 3 : '(, ({. @: (18!:2)))"0  (18!:1) 1'


On 1/2/07, Chris Burke <[EMAIL PROTECTED]> wrote:

Yuvaraj Athur Raghuvir wrote:
> I have been experimenting with locales and OO programming.
>
> I want to, at runtime,
> a) create a class (can be done by creating a locale)
> b) create a base class for the created class working at the instance
level.
> c) have access to instances that belong to a certain class.
>
> (a) works fine with the creation of boxed locales and inserting the
> create &
> destroy verbs (See mail chain following [1]). However, when I view the
> contents of the locale created dynamically using the view utility verb
in
> Learning J [2], I am not able to see the verbs I created in the locale.
Why
> is that so?
>
> (b) would mean that I should be able to simulate the verb coinsert at
> runtime effectively changing the type hierarchy. In J, I assumed that
would
> mean inserting a new locale in the the locale path.
>...

I don't understand all these questions, but sense there is some
misunderstand about what J is doing.

There is a suggestion that J has a "runtime" mode that is fundamentally
different from the development mode. But the only real difference
between developing and running an application is that the IDE reads in
more scripts at outset than are normally required for an application.
The J interpreter itself makes no distinction between runtime and
development.

Hence the "at runtime" should not be relevant here. Similarly, for
"dynamically" - everything in J is created dynamically, whether it is in
the IDE or when running an application. For that matter, the IDE itself
is created dynamically.

Thus, whatever the questions mean, if you can do them in the IDE, you
can do them in an application.

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