Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 4608 days ago | link | parent

Some ways to call Java from Rainbow are listed here: http://arclanguage.org/item?id=8819

I think the best way to get up to speed with Rainbow is to see it in action (https://github.com/conanite/rainbow/blob/master/src/arc/rain...) and to look at exactly what the selection of JVM-related primitives is (https://github.com/conanite/rainbow/tree/master/src/java/rai...).

A while back, I made a library, jvm.arc, that I find slightly more convenient to use for accessing JVM stuff from Arc, regardless of whether I'm using Rainbow or Jarc (http://rocketnia.wordpress.com/2010/06/01/lathes-arc-to-impl...).

More recently, jazzdev released a version of Jarc that implemented Rainbow's style of JVM access in addition to the Jarc style (http://arclanguage.org/item?id=12684). I cover a lot of corner cases in jvm.arc using reflection, and some of those could probably be implemented in a more direct style now.

One thing to note: Jarc and Rainbow each have their own policies for automatically converting between Arc values and java.util.Maps and such. This is convenient in practice, but it may make some corner-case things impossible without writing custom code in another JVM language like Java. For instance, if a single utility (say, a JSON parser) can return either java.lang.Boolean.FALSE or null, Arc will probably see nil in both cases.



1 point by jsgrahamus 4607 days ago | link

"I think the best way to get up to speed with Rainbow is to see it in action (https://github.com/conanite/rainbow/blob/master/src/arc/rain...)

So I looked at swing.arc and tried copying and pasting it into Jarc:

  Jarc> (java-imports java
    (lang Integer Float)
    (awt Font event.KeyListener))

  (stdin):1: Error: Symbol 'java' has no value

  0:      java
  DEBUG 0:
Does something need to be loaded before executing this?

Thanks, Steve

-----

1 point by varbanov 4606 days ago | link

java-imports is Rainbow specific construct. Jarc doesn't have such function. I guess Jarc doesn't have imports :)

varbanov

-----