Hacker News new | past | comments | ask | show | jobs | submit login
Rainbow (Arc implementation in Java) (github.com/conanite)
35 points by revorad on Jan 23, 2009 | hide | past | favorite | 8 comments



Does anyone know if this is a full Arc implementation? Like... does it have call/cc?


Don't know, but you could try looking at the author's submissions and comments in the Arc Forum, which include discussion of Rainbow:

http://arclanguage.com/user?id=conanite


Yes. It also supports features beyond the Arc "standard".


Very cool - how do you do Java interop? Also, Java has the curse of portability so you can't assume a unix, which Arc does, I think. How has that worked out?


Some Java interop instructions are here: http://www.arclanguage.org/item?id=8819

Arc runs on all platforms that MzScheme runs on, which includes Windows.


Ah, so apparently PG didn't go with the unix integration he mentioned once.

Your Java interop looks good, yet the code is a bit more verbose than the equivalent in Java. Also, can Arc lists and hashes be used as Java List and Map collections?


rainbow converts arc lists and hashes to and from java List and Map equivalents.

rainbow also uses 'defcall from anarki so you don't ever have to call java-invoke: you can put your java-object in functional position, followed by the method name, followed by the arguments. For example,

  (my-object 'hashCode)
is the equivalent of java's myObject.hashCode(); ... essentially the same number of tokens. I expect to wrap the most popular java libraries behind arc-sounding macros/functions.

rainbow comes with a tetris and a simple arc editor called welder, they both use java's Swing library, take a look if you'd like to see an example of this kind of wrapping. Or try http://www.fnargs.com/2009/01/calling-java-from-arc.html

I think "official arc" still assumes a unix for some functions ... I don't know what PG's final position on this is.


Apologies for the days of delay - I'm on a reduced HN diet.

So, in Clojure you can't use Java objects with the great sequence and hashmap libs:

(def h (new java.util.HashMap))

(. h put :a 1)

(. h put :b 2)

user=> h

#=(java.util.HashMap. {:b 2, :a 1})

Hashmaps in Clojure are, like Arc's, callable:

user=> ({:a 1 :b 2} :b)

2

But not if they are Java Maps:

user=> (h :b)

java.lang.ClassCastException: java.util.HashMap (NO_SOURCE_FILE:0)

So rainbow does the right thing - let's you use Arc functions on Java objects?

By the way, Clojure's .. macro is pretty handy:

(.. System (getProperties) (get "os.name")) expands to:

(. (. System (getProperties)) (get "os.name"))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: