> 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.
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?
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...
This is a great question, and to clarify for anyone not following along closely:
Some of us using TypeScript dream of a day when TypeScript emits JavaScript already annotated with type meditations which express as much of the typescript type system as possible in a way that Closure can understand, thereby making it possible for Closure to perform maximally efficient tree shaking and other magic with code that started as TypeScript. Such a thing as necessary and helpful because the addition of this detailed type data makes it possible for Closure to do a much better job that it can do with "just" untyped JavaScript.
Both Closure and TypeScript support (some of) the JSDoc type annotations and syntax (http://usejsdoc.org/). AFAICT, TypeScript supports a subset of what Closure does - so anything here should be portable between the two:
I just tested moving my Typescript/React template to Google Closure using a webpack plugin. It came in at 148KB with UglifyJS, and 102KB with Google Closure running after Typescript did the ES5 conversion.
This may not be the "integration" some are seeking but it's sure a step ahead.
Thanks! I'm fairly new to JS. I introduced a new dependency on a node module and for some reason gulp-uglify isn't working on production mode. I'm going to give this a try.
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 with some twists: The "j" is a tip of the hat to Java and the JVM where clojure is designed to run. This also has the nice property that the "zh" sound of the "s" in closure is also used with "j" sometimes (I think due to French). Thirdly I believe the "CL" letters of clojure are a tip to Common Lisp.
This is fantastic. I never thought I'd be celebrating yet another "now-in-JS" release, but clojure being Java was a constant pain in the CI gonads. Wonderful to finally be able to include this in generic npm packages without any crazy extraneous build steps.
I think it's mostly just a timing issue. To make it to the front page a submission needs to garner enough upvotes at a specific rate, and it's competing with other submissions at the same time.
Closure compiler is awesome, and the need to spin up a JVM to run it is really my only knock against it. This should lead to a nice boost in its usage.
performance is significantly worse for the simple example, anecdotally feels maybe 300%-400% slower.
not sure if it's just bootup time or actual compilation passes, hopefully the former and does not explode exponentially (or even linearly) with code size.
The advanced compilation mode does some pretty powerful dead code removal and minification [1]. I guess that is available from plugins in Babel as well but Google has been using it for Gmail, Google.com etc, so it's quite battle tested.
[+] [-] jashkenas|9 years ago|reply
[+] [-] Cyph0n|9 years ago|reply
[+] [-] johnhenry|9 years ago|reply
[+] [-] paulddraper|9 years ago|reply
[+] [-] minxomat|9 years ago|reply
[+] [-] strictfp|9 years ago|reply
[+] [-] dafrankenstein2|9 years ago|reply
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] manishsharan|9 years ago|reply
[+] [-] kylecordes|9 years ago|reply
Some of us using TypeScript dream of a day when TypeScript emits JavaScript already annotated with type meditations which express as much of the typescript type system as possible in a way that Closure can understand, thereby making it possible for Closure to perform maximally efficient tree shaking and other magic with code that started as TypeScript. Such a thing as necessary and helpful because the addition of this detailed type data makes it possible for Closure to do a much better job that it can do with "just" untyped JavaScript.
[+] [-] nevir|9 years ago|reply
https://github.com/Microsoft/TypeScript/wiki/JSDoc-support-i...
[+] [-] msoad|9 years ago|reply
[+] [-] technion|9 years ago|reply
This may not be the "integration" some are seeking but it's sure a step ahead.
[+] [-] nojvek|9 years ago|reply
Typescript understands most of closure comment syntax. They should throw typechecking errors which they currently aren't doing.
[+] [-] xntrk|9 years ago|reply
[+] [-] swannodette|9 years ago|reply
[+] [-] yegortimoshenko|9 years ago|reply
[+] [-] espeed|9 years ago|reply
https://groups.google.com/d/msg/clojurescript/jMSQChpCdhg/p7...
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] tomseldon|9 years ago|reply
If you're using Google Closure with Gulp in your work flow, you may find gulp-gjslint useful (https://github.com/TomSeldon/gulp-gjslint).
It's a gulp wrapper around gjslint, I. E. a Google Closure linter. :)
[+] [-] nhatbui|9 years ago|reply
[+] [-] sigjuice|9 years ago|reply
[+] [-] focusaurus|9 years ago|reply
"Clojure" is a programming language again based on the regular word "closure" but with some twists: The "j" is a tip of the hat to Java and the JVM where clojure is designed to run. This also has the nice property that the "zh" sound of the "s" in closure is also used with "j" sometimes (I think due to French). Thirdly I believe the "CL" letters of clojure are a tip to Common Lisp.
I'm not familiar with "Clozure CL" but the history is here: http://ccl.clozure.com/history.html
[+] [-] andrethegiant|9 years ago|reply
[+] [-] swannodette|9 years ago|reply
[+] [-] nothrabannosir|9 years ago|reply
[+] [-] jjdveifb|9 years ago|reply
[+] [-] victorvation|9 years ago|reply
[+] [-] sunkencity|9 years ago|reply
[+] [-] paulddraper|9 years ago|reply
(PS Is it possible to have a biased account? I see a lot of articles I had posted, later posted by someone else make it to the front page.)
[+] [-] grzm|9 years ago|reply
[+] [-] wehadfun|9 years ago|reply
[+] [-] triangleman|9 years ago|reply
[+] [-] mrcactu5|9 years ago|reply
http://clojurescript.org/
[+] [-] antouank|9 years ago|reply
[+] [-] jeremiep|9 years ago|reply
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] nfriedly|9 years ago|reply
[+] [-] austincheney|9 years ago|reply
[+] [-] leeoniya|9 years ago|reply
not sure if it's just bootup time or actual compilation passes, hopefully the former and does not explode exponentially (or even linearly) with code size.
[+] [-] paulddraper|9 years ago|reply
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] SpencerWood|9 years ago|reply
[+] [-] vikeri|9 years ago|reply
[1]: https://developers.google.com/closure/compiler/docs/api-tuto...
[+] [-] wildpeaks|9 years ago|reply
Babel can be used in the same toolchain as Closure Compiler, they're not mutually exclusive or redundant as they perform different tasks.
[+] [-] icholy|9 years ago|reply
[+] [-] randomguy7788|9 years ago|reply
use it with babel by using splittable.js
[+] [-] untog|9 years ago|reply
[+] [-] agumonkey|9 years ago|reply
[+] [-] aeosynth|9 years ago|reply