Arc Forumnew | comments | leaders | submitlogin
Using Arc with jQuery?
2 points by lplvlsl 4259 days ago | 4 comments
Hi, guys! I am new here and I am looking for some directions. I want to use arc for the client-side online application. I want to compile it to javascript, like people do with clojurescript.

Can you tell me - is it possible? Is it possible to use it along with js/jquery? I mean - can they interact, can some features be written in arc and some in jquery? If not - is there any way at all to use arc for making frontend application?

Can you please give me some idea on how to do that?



2 points by rocketnia 4259 days ago | link

When ClosureScript came out, it didn't support eval (and it still doesn't, I think!), so I was motivated to build an eval-capable version of Arc in the browser. Behold Rainbow.js:

https://github.com/arclanguage/rainbow-js (project page)

http://arclanguage.github.io/rainbow-js/test/ (interactive REPL)

It's a direct port of Rainbow (https://github.com/conanite/rainbow), but with a hand-rolled parser and a hand-rolled implementation of asynchronous stream I/O. Like Rainbow, it "compiles" Arc code to an intermediate representation and interprets that. Rainbow was already a fast Arc implementation (faster than official Arc!) so Rainbow.js is pretty speedy as well. I used to think it was even faster than Rainbow itself, but then I realized that was due to a bug. :-p

I haven't been motivated to use Rainbow.js myself, because it has many quirks: Some quirks of its own (e.g. no threads), some inherited from Rainbow (e.g. no bignums, and weird call/cc behavior during macroexpansion), and of course all the quirky features of Arc (e.g. ssyntax). It also has some quirks which are truly necessary to make it usable; for instance, its (load ...) implementation loads from the Web, because there is no filesystem. While this (load ...) fix makes some sense, it's not always clear to me what the best behavior would be. Instead of pondering these small design questions and imposing my own decisions on this project, I've been working on other language designs from the ground up instead.

By all means, see if you can get Rainbow.js to work. I don't have ideas to improve this project myself, but you're not the only one who's wanted to use something like this, so your ideas could could help those other people. :)

-----

2 points by rocketnia 4259 days ago | link

Here's another Arc-inspired language which runs in the browser:

https://github.com/Pauan/nulan (project page)

http://pauan.github.io/nulan/doc/tutorial.html (interactive tutorial in the browser)

Arguably, it improves upon Arc in many, many ways. :) Perhaps Arc's main advantage is that there are more people who use and maintain Arc. I'm sorry to say I've never used Nulan for anything, even though I'm suggesting it here.

-----

1 point by zck 4259 days ago | link

You'd have to write a compiler from Arc to Javascript. As far as I know, there isn't one.

Alternately, it might be easier to write a compiler from Arc to ClojureScript, and then use the existing ClojureScript compiler.

-----

1 point by thaddeus 4252 days ago | link

Just out of curiosity, why not just use ClojureScript? It seems like it has already been built for your purposes while arc has not.

-----