Live data from Hacker News

Building a Lisp to Javascript compiler

honza.ca

1–10 of 12 posts

Re: Building a Lisp to Javascript compiler

#4
post #2

"So, I decided to implement a simple version of Clojure that compiles to Javascript and can be run on top of nodejs." Did you know that Clojurescript can run on node.js? https://github.com/michaelsbradleyjr/node-clojurescript Cool project though!

The compilation step completely defeats the point of rapid prototyping in Node.js. I'm really used to just modifying my .coffee files to get the resulting .js files compiled instantly and transparently to me.

Closure does a great job in static analysis. It's not obvious, but Clojure's library is HUGE and has to be pruned of unused resources.

On the other hand, it's not very convenient for the developer because Closure's job takes a LONG time. I guess this is where this project comes in.

Re: Building a Lisp to Javascript compiler

#5
post #4
post #2

"So, I decided to implement a simple version of Clojure that compiles to Javascript and can be run on top of nodejs." Did you know that Clojurescript can run on node.js? https://github.com/michaelsbradleyjr/node-clojurescript Cool project though!

The compilation step completely defeats the point of rapid prototyping in Node.js. I'm really used to just modifying my .coffee files to get the resulting .js files compiled instantly and transparently to me. Closure does a great job in static analysis. It's not obvious, but Clojure's library is HUGE and has to be pruned of unused resources. On the other hand, it's not very convenient for the developer because Closur…

I'm working on a clojurescript project right now that compiles to 80K lines of javascript (using the most basic compilation level during development). In my actual workflow I've found that the compilation takes under 250ms each time. I have it auto-compiling every time I save the file using the lein cljsbuild plugin and it's near instant as far as I'm concerned.

Re: Building a Lisp to Javascript compiler

#7
post #5
post #4

Earlier quoted context omitted.

The compilation step completely defeats the point of rapid prototyping in Node.js. I'm really used to just modifying my .coffee files to get the resulting .js files compiled instantly and transparently to me. Closure does a great job in static analysis. It's not obvious, but Clojure's library is HUGE and has to be pruned of unused resources. On the other hand, it's not very convenient for the developer because Closur…

I'm working on a clojurescript project right now that compiles to 80K lines of javascript (using the most basic compilation level during development). In my actual workflow I've found that the compilation takes under 250ms each time. I have it auto-compiling every time I save the file using the lein cljsbuild plugin and it's near instant as far as I'm concerned.

That was not my experience with Clojurescript. I might have to try it again.

Re: Building a Lisp to Javascript compiler

#8
post #5
post #4

Earlier quoted context omitted.

The compilation step completely defeats the point of rapid prototyping in Node.js. I'm really used to just modifying my .coffee files to get the resulting .js files compiled instantly and transparently to me. Closure does a great job in static analysis. It's not obvious, but Clojure's library is HUGE and has to be pruned of unused resources. On the other hand, it's not very convenient for the developer because Closur…

I'm working on a clojurescript project right now that compiles to 80K lines of javascript (using the most basic compilation level during development). In my actual workflow I've found that the compilation takes under 250ms each time. I have it auto-compiling every time I save the file using the lein cljsbuild plugin and it's near instant as far as I'm concerned.

Do you mind giving a quick rundown of how you set up your environment, or at least a point in the right direction?

Re: Building a Lisp to Javascript compiler

#9
post #8
post #5

Earlier quoted context omitted.

I'm working on a clojurescript project right now that compiles to 80K lines of javascript (using the most basic compilation level during development). In my actual workflow I've found that the compilation takes under 250ms each time. I have it auto-compiling every time I save the file using the lein cljsbuild plugin and it's near instant as far as I'm concerned.

Do you mind giving a quick rundown of how you set up your environment, or at least a point in the right direction?

The most barebones version is very simple: lein has a plugin called lein-cljsbuild. In your project.clj there is a way to specify the directories this program needs to watch for file changes. lein cljsbuild has an option "auto" which activates the directory watcher and automatically recompiles the cljs files when one of them changes.

This long-running program keeps the same jvm running for all the compiles, and lets you iterate more quickly.

Re: Building a Lisp to Javascript compiler

#10
post #9
post #8

Earlier quoted context omitted.

Do you mind giving a quick rundown of how you set up your environment, or at least a point in the right direction?

The most barebones version is very simple: lein has a plugin called lein-cljsbuild. In your project.clj there is a way to specify the directories this program needs to watch for file changes. lein cljsbuild has an option "auto" which activates the directory watcher and automatically recompiles the cljs files when one of them changes. This long-running program keeps the same jvm running for all the compiles, and lets…

How are you finding the ClojureScript REPL? I wanted to play around with it, but gave up after finding out how much trouble it is to get running. I was hoping it would be as simple as Clojure's `lein repl`.
Post reply on HN