by Fudgel on 9/28/23, 7:55 AM with 90 comments
by paul on 9/29/23, 4:25 AM
One detail this story gets wrong though is the claim that, "The Gmail team found that runtime JavaScript performance was almost irrelevant compared to download times." Runtime performance was actually way more important than download size and we put a lot of effort into making the JS fast (keep in mind that IE6 was the _best_ browser at the time). One of the key functions of the js compiler was inlining and dead-code removal so that we could keep the code readable without introducing any extra overhead.
by no_wizard on 9/28/23, 8:16 PM
- First and foremost a Google tool, not a tool meant for the masses, per se[0]. It could do great things, but it had the dependency on closure tools, which were not the easiest to use outside of Google (did anyone outside google actually use the `goog.*` stuff?) and writing annotation files (externs) of libraries and such never caught on and weren't shared in some meaningful way.
- Lacked evangelism. I imagine this had to do with the above. There weren't people from Google singing the benefits loud and proud everywhere about using the Closure Compiler
- Docs weren't the best. Some parts are still broken (links and such).
- It didn't evolve. Closure could have been a pretty great bundler too, actually, but it didn't support ESM for a long time and it was never clear how to get it bundle things even when it did, I think you mostly had to declare each dependency file for it to work correctly, but I never myself got it to work 100%
These are some of the things that I think ended up holding it back. It could have been a cool little ecosystem too. There was a sister project called Closure Stylesheets that was for CSS that was supposedly very good as well, though I think thats no longer maintained. I believe it was very similar to how people use PostCSS in terms of what it did
[0]: Lots of projects use it to minify their JS but never really took advantage of the advanced functionality it can provide on top.
by lukehoban on 9/29/23, 2:22 AM
From https://medium.com/hackernoon/the-first-typescript-demo-905e...:
> There were many options already available, but none seemed to be resonating well with a broad enough section of the market. Internally at Microsoft, Script# was being used by some large teams. It let them use C# directly instead of JavaScript, but as a result, suffered from the kind of impedance mismatch you get when trying to stand at arms length from the runtime model you are really programming against. And there was Google’s Closure Compiler, which offered a rich type system embedded in comments inside JavaScript code to guide some advanced minification processes (and along the way, caught and reported type-related errors). And finally, this was the timeframe of a rapid ascendancy of CoffeeScript within the JavaScript ecosystem — becoming the first heavily used transpiled-to-JavaScript language and paving the way for transpilers in the JavaScript development workflow. (Aside — I often explained TypeScript in the early days using an analogy “CoffeeScript : TypeScript :: Ruby : C#/Java/C++”, often adding — “and there are 50x more C#/Java/C++ developers than Ruby developers :-)”)
> What we quickly discovered we wanted to offer was a “best of all worlds” at the intersection of these three — a language as close as possible to JavaScript semantics (like CoffeeScript) and syntax (like Closure Compiler) but able to offer typechecking and rich tooling (like Script#).
by jwr on 9/29/23, 7:01 AM
I'm not sure why the author believes that "minification was a design goal". Minification is a side effect.
> "In the context of npm in 2023, this would be impossible. In most projects, at least 90+% of the lines of code are third-party. "
Well I guess that's why I avoid using npm and why I can maintain code for 8 years and still keep my sanity. I keep the use of third-party code to a minimum, carefully considering each addition, its cost over time, and the probability that it will be maintained.
As a side note, I think it's immature to use terms like "X won" or "Y is dead" in tech discussions.
by paulddraper on 9/28/23, 9:20 PM
When I was at Lucidchart, I helped convert the 600k line Closure codebase to TypeScript. [1] In fact, Lucidchart still uses Closure (for minification+library, not typechecking).
There are better approaches available in 2023, but Closure Compiler will always have special place in my heart.
[1] https://www.lucidchart.com/techblog/2017/11/16/converting-60...
by capableweb on 9/28/23, 7:59 PM
Unless, of course you were at the forefront of frontend stuff like a decade ago and Closure Compiler was the absolute best for a long time at dead-tree elimination and compressing JS artifacts. Or, you're a developer using ClojureScript. Or...
> It occupied a similar niche to TypeScript, but TypeScript has absolutely, definitively won.
Huh? The Closure Compiler is so much more than just "JavaScript but with types". It also provides minification, provided a namespacing system, additional standard library and such.
by latte on 9/28/23, 10:24 PM
Edit: ClojureScript still depends on Google Closure.
by baron816 on 9/29/23, 5:18 AM
If you’re not acutely aware of it and you do a `myObj[‘someProp’]`, you’re not going to get any in code warnings, everything will work as you expect in development, and you’re tests and presubmit checks will pass. On multiple occasions for me, the problem surfaced in production, and there was no one around to tell me that property renaming was even a thing. I had to try to debug compiled code.
Worse still is that you don’t even have to try to do a `myObj[‘someProp’]` to get into trouble. There is very commonly used library code that will cause the same problem—you’re just calling a method that tries to access a property on an object. But since it’s abstracted, it’s even harder to catch during a code review or to debug the problem.
by noelwelsh on 9/28/23, 8:20 PM
by zubairq on 9/29/23, 3:18 AM
by err4nt on 9/28/23, 8:56 PM
It's easy to see this set of JavaScript and CSS tools as ahead of their time, and the first of the particular kind of toolset that followed in the years after it.
by arthurbrown on 9/28/23, 10:54 PM
They used the exact same approach as visual studio and .NET, and managed to eat up the entire fragmented ecosystem in a matter of years.
by jawns on 9/28/23, 8:22 PM
Unfortunately, my opinions about Closure are colored by how it was used within my org -- which was far from ideal. We should have taken the best of Closure (the compiler, type checking, and maybe a few utility libraries) and ignored most of the rest.
When we switched all greenfield JS development from Closure to React around 2016, it resulted in a 2-3x speed-up in the development process. Not because the compiler stage added any significant time to our process, but because of poor design patterns that were implemented because Google was using them -- but perhaps not with the correct level of understanding about how to use them effectively.
by stevage on 9/28/23, 10:33 PM
Weird have been interesting to include Facebook's Flow. That one seems pretty similar to TypeScript but more oriented towards Facebook's specific needs than a genuinely open source tool.
by marksomnian on 9/28/23, 9:16 PM
by artieg on 9/29/23, 1:03 AM
by moomin on 9/29/23, 11:15 AM
by sod on 9/29/23, 8:46 AM
by temporallobe on 9/29/23, 1:08 AM
by charcircuit on 9/29/23, 2:04 AM
by omoikane on 9/29/23, 12:08 AM
by Cameri on 10/4/23, 2:21 PM
by dheerajvs on 9/29/23, 6:58 AM
> It's self-hosted (tsc is written in TypeScript)
Why would that matter? What if TypeScript was written in Rust? I would assume the better performance would have increased its adoption even more.
by nikitaga on 9/29/23, 8:28 AM
It's not like Typescipt somehow solved code minification in a way that made Closure compiler redundant. It's still used where it makes sense (e.g. to compile Scala.js output, although other solutions like terser.js work too).
by pard68 on 9/28/23, 8:09 PM
by nicup12345689 on 9/28/23, 11:28 PM
by ramesh31 on 9/28/23, 8:39 PM