[rkward-devel] JS in rkwarddev [was: splitting repos?]

meik michalke meik.michalke at uni-duesseldorf.de
Fri Oct 16 20:51:49 UTC 2015


hi,

Am Freitag, 16. Oktober 2015, 17:36:23 schrieb Thomas Friedrichsmeier:
> The generation of the JS is still what I like least about rkwarddev.

me too. the JS part has always been the least favourable for me, no matter 
how.

> Trying to debug JS code that is all quoted, without syntax highlighting, and
> interspersed with fragments of R code is always giving me a headache.

understandable. i think it takes a lot of time to get into the kind of 
thinking there.

> Perhaps this might be a good opportunity to think about a - slightly - less
> integrated solution for this, where the JS file could be kept on its own,
> instead of inline-quoted?

this has always been possible if you remove "js" from the "create" argument of 
rk.plugin.skeleton(), rkwarddev will not touch the .js file in place then. 
this will of course disable all automation that is done, like automatic 
variable definitions, automatically added code for saving objects or previews, 
etc.

> I could think of two approaches, neither of which
> may be ideal, but perhaps they can trigger some further ideas:

i personally wouldn't want to do without the R functions any longer, but maybe 
we can find some useful template solution with R code in specially marked JS 
comments (similar to roxygen).

the main problem is variable names. rkwarddev generates all of those 
automatically from the given ID tag, keeping them identical in XML and JS as 
long as no forbidden characters are used, and also generates IDs automatically 
from label names and node types. my main goal was to not have to worry about 
any ID stuff any longer, as that was always driving me crazy before. i wanted 
to re-use an object i defined once, be it in XML or JS code, and let rkwarddev 
worry about how what is called.

one thing to get more direct control could be to already define the JS 
varaible names in the rk.XML.*() calls for later use, so you know what element 
will be called how in the JS file if you want to rely on the rest of 
rkwarddev's automatisms. this is not possible with ordinary XiMpLe objects, 
because they only know node name, attributes, child nodes and text value. i 
could use an extended class in rkwarddev, but that would mean major changes 
all over the package. i could also extend the XiMpLe classes with a slot that 
can host arbitrary stuff in a list that we could use. given that XiMpLe was 
written particularly to make rkwarddev possible in the first place, this is 
perhaps the way to go. this should make it easy to write JS in JS, because you 
would know which variable names to use.

well, right now, all of this sounds a bit like for another life... ;-)


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  institut f"ur experimentelle psychologie
  abt. f"ur diagnostik und differentielle psychologie
  heinrich-heine-universit"at d-40204 d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20151016/53bf727f/attachment.sig>


More information about the rkward-devel mailing list