p j wrote:
> regarding nested definitions,
> Its convenient.  Keep small related classes and their
> descendants in the same file.  Have a step in between
> anonymous functions and locale-wide definition.  Cases
> where its not important enough to name outside of a
> narrow scope, but still will be used more than once.

Note that you would pay a run-time cost for nested blocks.

Some of that could be eliminated by paying a complexity cost in the
implementation, but J's syntax is context dependent, so you could not
entirely eliminate this cost.  (Names, and the results of adverbs and
conjunctions can have different syntactic properties at different
times.)

> > > This could hopefully let us define multiple
> > > classes inside general files, as well as private 
> > > explicit verbs only useful in narrow scopes.
> > 
> > Of course, both are already possible.
> 
> Much like `'' I don't know about it.  You can define
> multiple classes in 1 file?  with non class related
> functions too? 

Sure.  Regardless of whether you're using the older coclass 'name'
syntax or the proposed class_name_ '' syntax, you can define multiple
classes in one file.

And, cocurrent'base' takes you out of class definition mode.

For example

coclass 'class1'
methodA=: ...

coclass 'class2'
methodB=: ...

coclass 'class3'
methodA=: ...

cocurrent 'base'
nonClassFn=: ...

These classes would have no relationship to each other, unless you
declare one.

As an aside, I highly recommend the labs on locales and object
oriented programming.  They're a bit verbose in spots (and I always
think of http://www.homestarrunner.com/sbemail58.html when I see the
line "J makes OOP easy"), but they're still worth doing. 
More than once.

-- 
Raul


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

Reply via email to