> From: Sherlock, Ric
>
> In this case when you invoke plot from the base locale, the plot verb
> is found in the z locale
> copath 'base'
> +-+
> |z|
> +-+
> If you look at the definition of plot_z_ you will see that it is pretty
> much a cover verb for plot_jwplot_
> copath 'jwplot'
> +------+----+----+-+
> |jzplot|jafm|jgl2|z|
> +------+----+----+-+
>
> So most of the words are being invoked from the jwplot locale which
> will however look in the jzplot locale for words it doesn't find in
> jwplot. The pzplot locale isn't in the path however and so won't get
> searched.
However this does suggest another alternative to defining the verbs/nouns
directly in the jzplot locale. We could insert the pzplot locale in the path of
jwplot, above jzplot, so any names defined in pzplot would take precedence over
definitions in jzplot.
NB.========== script skeleton ==================
require 'plot'
((<'pzplot'),copath 'jwplot') copath 'jwplot'
coclass 'pzplot'
coinsert 'jzplot'
PlotTypes2d=: PlotTypes2d ,<'sbarn'
PlotTypes=: ~. PlotTypes2d,PlotTypes3d
plot_sbarn=: 3 : 0
'x y'=. 2 {. y { Data
dat=. citemize y
pos=. makestackbarn dat
pos makedrawbar dat
)
makestackbarn=: 3 : 0
'r c'=. $y
NB ... etc
)
NB. ============================================
copath 'jwplot'
+------+------+------+----+----+-+
|pzplot|pzplot|jzplot|jafm|jgl2|z|
+------+------+------+----+----+-+
copath 'pzplot'
+------+----+----+-+
|jzplot|jafm|jgl2|z|
+------+----+----+-+
names_pzplot_''
PlotTypes PlotTypes2d makestackbarn plot_sbarn
I've tested this and it works.
I'd be interested in any discussion of the relative merits of this approach
over (re)defining objects directly in the jzplot locale. The main thing I'd be
worried about with this approach is that the inheritance tree could get messy
and hard to sort out, especially for multiple custom types?
A simpler idea would be to just use the jwplot locale (currently empty) for all
custom types, but that would limit the ability to make one custom type an
extension of another?
Thoughts anyone?
> If you haven't done the Locales lab yet (Studio|Labs|Locales), I'd
> recommend it.
>
>
> > From: Thomas Costigliola
> >
> > Thanks for the script, that was my idea but I didn't think I had to
> > explicitly define the verbs in the jzplot locale by adding the
> > _jzplot_ becuase of the coinsert statement. Why is this necessary?
> >
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm