Live data from Hacker News

Closure Compiler in JavaScript

developers.googleblog.com

91–100 of 115 posts

Re: Closure Compiler in JavaScript

#91
post #57

Earlier quoted context omitted.

There's no intrinsic property of “desktop” languages preventing them targeting “browser” languages. Any Turing-complete language can be compiled to and from any other. And you don't even need to go down to that level of abstraction for Java-to-JavaScript, the two share many commonalities. Java classes can become JavaScript objects, Java methods can become JavaScript functions, Java exceptions can become JavaScript ex…

So I don't know much about Java, but I was under the impression that it compiles to a binary fie (like C), and thus could do things that directly affect the hardware like malloc. How would Javascript handle something like that? I'm not aware of Javascript being able to perform these kinds of tasks. I guess they just have workarounds, like what you're saying for file access?

> do things that directly affect the hardware like malloc

All your code affects the hardware in the sense of read/write RAM and run on CPUs. C and malloc has fewer layers than JS and new, but they're similar.

Re: Closure Compiler in JavaScript

#93

Can anyone comment on the state of Typescript - Google Closure integration ?

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…

We are working on this here:

https://github.com/angular/tsickle

It's already used within Google to effectively optimize TypeScript apps. However, someone still needs to write the integrations between tsickle and the multitude of public JS build systems and there's not a lot of pressure on me to do it (I have lots of other work to do).

Re: Closure Compiler in JavaScript

#94
post #31

Can anyone comment on the state of Typescript - Google Closure integration ?

Tsickle isn't that great, Webpack plugings are not not letting CC do the bundling. In general it's not good!

I commented elsewhere in this thread, but: tsickle is mostly the work of one person (me) who also has other responsibilities. I'd love some help on it, particularly in integrating it into the world of webpack etc.

https://github.com/angular/tsickle/graphs/contributors

Re: Closure Compiler in JavaScript

#95
post #64

Can anyone comment on the state of Typescript - Google Closure integration ?

What do you mean by Typescript Google closure integration? Typescript understands most of closure comment syntax. They should throw typechecking errors which they currently aren't doing.

TypeScript understands some of the comment syntax, but the type systems are different, the module systems are different, and a ton of other stuff is different. Look through the test cases in https://github.com/angular/tsickle/tree/master/test_files to see the difference between TypeScript-annotated code and Closure-annotated code.

Re: Closure Compiler in JavaScript

#96

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.

Also probably 10x slower, at least! Still cool because JavaScript I guess

Re: Closure Compiler in JavaScript

#97
post #93

Earlier quoted context omitted.

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…

We are working on this here: https://github.com/angular/tsickle It's already used within Google to effectively optimize TypeScript apps. However, someone still needs to write the integrations between tsickle and the multitude of public JS build systems and there's not a lot of pressure on me to do it (I have lots of other work to do).

Oh yes, I've been following this, at least the bits of information that emerge publicly.

But my dream is that this work could make it back into typescript itself - that a future version could possibly be persuaded to emit Closure type limitations without the help of a parallel/postprocessing pass by a tool.

Re: Closure Compiler in JavaScript

#98
post #57

Earlier quoted context omitted.

So I don't know much about Java, but I was under the impression that it compiles to a binary fie (like C), and thus could do things that directly affect the hardware like malloc. How would Javascript handle something like that? I'm not aware of Javascript being able to perform these kinds of tasks. I guess they just have workarounds, like what you're saying for file access?

It's java source to javascript source compilation(/translation/transpilation), so you only need to follow the semantics of the language, not the actual implementation. As a simple example, if you create an array of numbers in Java, you don't need to worry about how the memory for that is allocated as long as you get an array of numbers in javascript. The difficulties are more in how you get around where the two langu…

>...so you only need to follow the semantics of the language, not the actual implementation.

Wouldn't you need to follow the syntax and not the semantics? Aren't the semantics what the syntax is abstracting? (I'm genuinely curious, not trying to flame.)

Re: Closure Compiler in JavaScript

#100

Clojure or Closure? What language are they talking about?

As mentioned in the article, this is the Google Closure Compiler, which is used for compiling JavaScript. There is also the Closure Compiler (for compiling JavaScript) written in Java. As the title indicates, this is about a new implementation written in JavaScript.
Post reply on HN