Live data from Hacker News

Closure Compiler in JavaScript

developers.googleblog.com

71–80 of 115 posts

Re: Closure Compiler in JavaScript

#71
post #32

> How does this work? > > This isn't a rewrite of Closure in JavaScript. Instead, we compile > the Java source to JS to run under Node, or even inside a plain old > browser. Every post or resource you see about Closure Compiler will > also apply to this version. Pretty wild.

I'm really interested in how they did that. Do they have an internal Emscripten equivalent for Java bytecode? Or would it be more like a source code conversion compiler a la Nim or Haxe?

[deleted]

Re: Closure Compiler in JavaScript

#72

What's with all these similar and confusing names; Closure Compiler, Clojure, Clozure CL?

So "Closure" is a real comp sci word used to describe variable scope lifetimes in languages includes JavaScript and others. So when google named their project, they basically took a word from JavaScript/CompSci that starts with the same letter as "Compiler" (plus other similar sounds). I don't think there's much more to it than that. "Clojure" is a programming language again based on the regular word "closure" but wi…

> So when google named their project, they basically took a word from JavaScript/CompSci that starts with the same letter as "Compiler" (plus other similar sounds). I don't think there's much more to it than that.

Isn't it because it can optimize the output so that it only includes those dependencies that the program references, i.e. the whole program is like a closure that closes over its dependencies?

Re: Closure Compiler in JavaScript

#75

This is Google's JavaScript to JavaScript compiler, originally written in Java, but compiled with their Java to JavaScript compiler so that it runs in JavaScript... fair enough...

We need to go deeper...

... which is JIT-compiled with their JavaScript-to-machine-code compiler.

Re: Closure Compiler in JavaScript

#77

Earlier quoted context omitted.

I'm not sure this is what Gosling had in mind when he said "compile once, run anywhere" :P

To nitpick they are compiling separately for the js version ;)

Though if you consider JS the universal runtime (Node, Nashorn, browser), then it is just once.

Re: Closure Compiler in JavaScript

#79

What's with all these similar and confusing names; Closure Compiler, Clojure, Clozure CL?

So "Closure" is a real comp sci word used to describe variable scope lifetimes in languages includes JavaScript and others. So when google named their project, they basically took a word from JavaScript/CompSci that starts with the same letter as "Compiler" (plus other similar sounds). I don't think there's much more to it than that. "Clojure" is a programming language again based on the regular word "closure" but wi…

I heard that Rich Hickey chose Clojure because it has both `CLR` and `J` - initially he thought Clojure will be adopted in both - .Net CLR and JVM
Post reply on HN