Am Samstag, 24. Oktober 2015, 21:05:08 schrieb Thomas Friedrichsmeier:
> > that is, operators like !=, ==, > etc. are prevented from evaluation
> > by jo() and pasted as-is to the JS code.
> 
> Neat hack! But not a path I'd like to go, personally. To be honest,
> those ite()-statements just give me the shivers, in the first place.
> It's simply a pradigm that helps spreading the logic between (literal)
> JS and R (from which JS is to be generated), and I just fail to see the
> actual benefit. (Ok, I would see the point, if you could actually move
> _all_ logic from literal JS to R, but that does not seem to work out).

i've just replaced the jo() function with the more powerful js() function:

it is now possible to use plain if() conditions (nested as deep as you 
wish...) in rkwarddev to re-generate equivalent JavaScript conditions:

old way (still works):

  ite(id(x, " != \"\""),
    echo(", select=c(", x, ")"),
    echo("")
  )

new way:

  js(
    if(x != "") {
      echo(", select=c(", x, ")")
    } else {
      echo("")
    }
  )

both will lead to a JS printout of this:

  if(x != "") {
    echo(", select=c(" + x + ")");
  } else {
    echo("");
  }

this can most likely be done for other conditional statements as well. but as 
of now everything after the first call is being discarded, i yet need to add a 
while loop to check for more... however, i consider this kind of a 
breakthrough ;-)


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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
rkward-devel mailing list
rkward-devel@kde.org
https://mail.kde.org/mailman/listinfo/rkward-devel

Reply via email to