7 ms·
Introducing Closure Tools
- rbarr 17y agoWhat an unfortunate name. Perhaps, in the confusion, it will help to actually promote Rich Hickey's wonderful work.
- bockris 17y agoI'm with you. I totally read Closure as Clojure.
- freakwit 17y agoI totally read read as read.
- frognibble 17y agoIt was called Closure before Rich announced Clojure to the world.
- flatline 17y ago"Closure" being a general concept in programming, I always disliked the name "Clojure". Same thing as Google Chrome, everyone is now confused when you talk about browser chrome as a general thing.
- yason 17y agoNaming is a pretty powerful thing. If you name your crap with regular nouns, what's left for others there? Like, suppose you build a crappy GUI system and just dub everything based on simple self-describing words such as windows, word, notepad, internet explorer, you might end up wildly successful yet for reasons other than technical superiority.
- jriddycuz 17y agoI agree that "Clojure" is kinda a silly name, but what else are you gonna call it? I assume Henly wanted a name that conveyed its functional and/or Lisp roots, and the fact that it's on the JVM. Let's try some names using the usual JVM language conventions: JLisp works, but it's boring, and Jisp sounds kinda suspect. Parenjases is just silly. Or maybe LLBeans for "lazy lisp beans"...but that's just getting too cute. I think I probably would have gone with Jambda.
- logicalmind 17y agoIn case people are wondering, here is how the Clojure name came about: "Clojure is pronounced the same as the word "closure". The creator of the language, Rich Hickey, explains the name this way: "I wanted to involve C (C#), L (Lisp) and J (Java). Once I came up with Clojure, given the pun on closure, the available domains and vast emptiness of the googlespace, it was an easy decision."" At least this is how it is outlined in this document: http://java.ociweb.com/mark/clojure/article.html http://java.ociweb.com/mark/clojure/article.html
- adriand 17y ago"what else are you gonna call it?" How about "Armadillo"?
- oliverkofoed 17y agoYears ago, i wrote a compressor for javascript. I called it "Arnold" because it was strong and squeezed javascript into a smaller shape.
- ynniv 17y agoThats a terrible argument... He did indeed "announce Clojure to the world" before Google did, and now we all associate the phonetic name with him. Treat "closure" as a project name and pick a different product name, Google.
- s3graham 17y agoWhat about http://www.clozure.com/clozurecl.html http://www.clozure.com/clozurecl.html? I believe it was Clozure before Clojure was released (but I could be wrong).
- mahmud 17y agoHow about the Closure web browser which predates both Clozure and Clojure? http://www.cliki.net/Closure http://www.cliki.net/Closure
- gojomo 17y agoEven without the near-collision with 'Clojure', the full-collision with the 'closure' concept is problematic. They should prepend or append a 'G' or 'JS' for clarity (to both humans and indexers). EG: GClosure, JSClosure, ClosureG, or ClosureJS
- notaddicted 17y agoI'm getting disillusioned with software naming. Everyone wants a cool name that's fun to say, but all the names mean other things too, and quite a few don't describe the project very well.
- petercooper 17y agoDespite the closeness in name, aren't they pronounced differently? I've always pronounced "Clojure" with a hard "j," rather than like "closure." Edit: Turns out soft "j" is order of the day, there's a whole discussion about it: http://groups.google.com/group/clojure/browse_thread/thread/e2e0f178e4bca706 http://groups.google.com/group/clojure/browse_thread/thread/... - so confusion can continue to reign ;-)
- jimbokun 17y ago"Clozure" is taken as well. http://www.clozure.com/clozurecl.html http://www.clozure.com/clozurecl.html Any other consonants that can be shoe-horned into that slot?
- bokchoi 17y agoClo-de-jour?
- Confusion 17y agoI think most of the intended audience will not find 'Closure' confusing, because they are unaware of the concept that already has that name. The overlap of people interested in Clojure and people interested in Closure is rather small.
- caffeine 17y agoThe overlap of people interested in Clojure and people interested in Closure is rather small. This entire thread is evidence against that point.
- jamesbritt 17y ago"I think most of the intended audience will not find 'Closure' confusing, because they are unaware of the concept that already has that name." Pretty sad to expect that so many people working with JavaScript will not know what a closure is. Not that you're wrong; I honestly don't know, but would hope things aren't so bad.
- Sandman 17y agoThis is indeed an unfortunate name. The word 'closure' was, at first, used to describe a concept in programming: http://en.wikipedia.org/wiki/Closure_(computer_science) http://en.wikipedia.org/wiki/Closure_(computer_science). Then Clozure and Clojure came along. Now, I can see how these two are related to the aforementioned concept, but I simply can't see what these 'Closure tools' have to do with the concept of closures. Yet the name would suggest that they do. Is there anybody from Google that would care to explain?
- Elfan 17y agoNote that the word closure has meaning in set theory and other areas of mathematics relevant to computer science. SICP explicitly avoids using what wikipedia calls a 'computer science closure' for this reason.
- blasdel 17y agoIt's not quite as bad as PrototypeJS -- the most ironically named library ever. The whole point of it is to force Class-based bullshit onto the only pure Prototype-based language anyone uses. It's named after the concept it's designed explicitly to stamp out. So depressing.
- mkramlich 17y agoDepressing? Don't talk to me about depressing. I'll be over in the corner rusting for the next nine million years. -- Marvin
- aboodman 17y agoPicking a name for a software project is one of the few areas where a developer gets to kick loose and be completely creative, and even fanciful. Personally, I love picking names that recast old words in a new way, and think Closure is a great name for this project.
- caffeine 17y agoWhy is it called Closure? Does it close stuff? Does it pass functions and bindings? What could possibly have inspired them to use this particular name?
- jurjenh 17y agoI suspect the confusion will only affect people that don't need the specific implementations... People that want Closure for their JS goodness will know which it is, similarly for Clojure and Clozure lisps. And I generally search out new tools by description rather than name, so the naming issue becomes more of a marketing issue than anything else, and given the name space, it does seem a relatively hot area at the moment... At least they didn't go for something like GJST...
- jbyers 17y agoFor one of our JS bundles it's a substantial improvement over YUI's Compressor. Original: 459220 YUI: 241920 Google: 209929 -- 13% improvement YUI + gz: 66164 Google + gz: 61297 -- 7% improvement Caught a few non-fatal syntax errors too. We serve hundreds of thousands of those a day, so that's already committed to our tree and on the way to testing.
- lpolovets 17y agoHere's another data point: I downloaded jquery-1.3.2.js and jquery-1.3.2.min.js from http://docs.jquery.com/Downloading_jQuery#Current_Release http://docs.jquery.com/Downloading_jQuery#Current_Release > wc -c jquery-1.3.2.js 120763 > wc -c jquery-1.3.2.min.js 57254 > java -jar compiler.jar --js jquery-1.3.2.js | wc -c 55340 Using Google's compiler saves an additional 4% over the existing minified version (disclosure: I used to work for Google)
- jeresig 17y agoI definitely plan on switching jQuery over to using this compressor - excited by the output. However it appears as if it crashes when you push the latest nightlies of jQuery in. Not sure what's up with that.
- jauderho 17y agoOut of curiousity, I threw together a quick comparison using SlickSpeed and the latest jQuery/Prototype frameworks. http://bit.ly/1Ei4o8 http://bit.ly/1Ei4o8 If someone wants to contribute a jQuery version compiled with advanced opts, I'll be happy to add it to the list.
- phren0logy 17y agoI'm pretty sure this is what Steve Yegge was talking about on the most recent StackOverflow podcast he was in. If that is accurate, it's a JavaScript compiler that supports a way of partially compiling to allow very tight integration with an IDE (or editor). Yegge's point was that an IDE or editor should not have to re-invent the wheel and a compiler should be able to provide sophisticated feedback about syntax, objects, variables, scope, etc. Cool to see it out in the wild.
- lupin_sansei 17y agoYes here's the link http://blog.stackoverflow.com/2009/04/podcast-50/ http://blog.stackoverflow.com/2009/04/podcast-50/
- ironsam 17y agoIt's not compiling anything.
- Elfan 17y agoUsing this code on the code here (except for processing.js): http://github.com/cburroughs/minification-compare/tree/master/sample-files/js/ http://github.com/cburroughs/minification-compare/tree/maste... Latest full release of yuicompressor vs closure at SIMPLE_OPTIMIZATIONS level: ----- TOTALS ----- base: yui-compressor-2.4.2 ('abs diff:', '768050', 'gz: ', '184071') ('% change: ', -0.56976157623774126, 'gz: ', -0.51009685330672982) challenger: closure-compiler ('abs diff:', '814830', 'gz: ', '193817') ('% change: ', -0.60446432545511197, 'gz: ', -0.53710493134361448)
- justinhj 17y agoSo now there is Clozure common lisp, Clojure for the JVM, and now Closure. I was already getting the first two mixed up.
- DannoHung 17y agoI am never going to be able to refer to an actual closure again and have anyone understand what I'm talking about, am I?
- harto 17y agoI already find that hard enough - I've found that people tend to conflate first-class functions with closures.
- mjs 17y agoWell, is there any real different between a first-class function and a closure that closes over nothing? Is it possible for a language to support closures without first-class functions? How common is it to have first-class functions without closures? (I think Python sort of had this arrangement, but I think this is fixed now.)
- andreyf 17y agoA closure is just a (function, bindings) pair, so Python certainly has closures. The problem with Python is that there is no syntax for assigning to variables declared in an arbitrary scope, because there are no explicit declarations. As far as I understand, implicit local variables are what causes the problems in Python, not anything about closures, really. This causes other problems, too, such as those PG described here [1], under the heading "Implicit local variables conflict with macros". 1. http://www.paulgraham.com/arclessons.html http://www.paulgraham.com/arclessons.html
- mjs 17y agoInteresting. Thanks.
- gruseom 17y agoWould anyone who already knows this tool, or is taking the time to learn it, care to explain what they mean by "compiles web apps down into compact, high-performance JavaScript"? I assume this is a JS-to-JS translator. How exactly are they transforming the JS? I mean, of course, besides the obvious things they mention: minification, removing dead code, and some error checking.
- seiji 17y agoTake a look here: http://code.google.com/closure/compiler/docs/api-tutorial3.html#better http://code.google.com/closure/compiler/docs/api-tutorial3.h... When you turn on advanced mode they do automatic inlining, variable substitution, and they don't respect the globalness of anything unless you specifically force something to be global. YUI Compressor assumes anything not in a function is global, so it won't rename top level objects. Closure in advanced mode will trample through your globals and property names like rhinos mating in a field of daises.
- lupin_sansei 17y agoI get concerned that these minimisers and js to js compilers will introduce subtle bugs and changes into the behaviour of my code. Is that concern warranted?
- seiji 17y agoClosure advanced mode will absolutely screw with your code. Closure simple mode and YUI Compressor won't change the behavior of your code. They just rename completely encapsulated objects with shorter names and remove unnecessary semicolons.
- sh1mmer 17y agoThis is one of the things I've been wondering about. I'd like to look at ways to get Closure to be more holistic in it's approach. YUI Compressor has always been safe. I think the concern I have is that the new, exciting features here are the unsafe ones and, obviously, those are the ones that are dangerous. I'd be really interested in seeing how we can make features like this safe again. For example, by scraping a page, rather than just a JavaScript file to see which methods are genuinely unused instead of those unused in an undefined context of an unlinked JS file.
- niels 17y agoI've been curious about some of the tools behind Google's javascript power. The Closure Library coupled with the compiler looks really useful for creating complex and fast web apps.
- slig 17y agoIt took me a while to figure this out, but there's a lot more than "just" a js compiler. Since nobody here commented about it, I guess I'm not the only one that didn't see it. We can now use all the google fancy widgets (from gmail, gdocs, etc). Check this: http://closure-library.googlecode.com/svn/trunk/closure/goog/docs/index.html http://closure-library.googlecode.com/svn/trunk/closure/goog...
- xal 17y agoI think there is way to much attention on the compiler. It's neat but not that big of a deal. The key here is that they released their widget library. Tons of great stuff with very high code quality. This also includes the document editor from google docs which is by leaps and bounds the best engineered WYSIWYG editor out there.
- leif 17y agoWow, I have been seriously missing this outside google-land. So happy it's released; it's a fantastic set of tools, even if you only use the compiler as a glorified lint.
- fortes 17y agoGiven your experience with the tool, any tips or best practices? I already use lint in my build system, this looks like a good companion as well.
- leif 17y agoIIRC, the framework is largely based on dojo, so if you're familiar with that you'll have an easier time getting used to it. Don't remember many specifics, I just remember liking it. Good luck!
- Elfan 17y agoHow many lint-like tools use a full AST? pylint yes, but I doubt the original did.
- leej 17y agoi DONT get this attitude of Google. even MS uses jquery but the open source king Google do not. is this so hard to improve upon Firefox or Ubuntu or even much less complex jquery?
- jonknee 17y agoGoogle uses (and hosts free for everyone) jQuery. You can even use their new compiler to get a smaller version of jQuery. The widget library has some overlap with jQuery, but does so much more and has been in progress since well before jQuery UI (Google bought Writely in March 2006 and jQuery UI didn't come out until September 2007).
- leej 17y agoMS uses and hosts free too. what is your point? i'm talking about progressing current successful open source projects. fyi, its library has overlap with jquery core too!
- nostrademons 17y agoClosure existed well before JQuery did. It's non-trivial to switch an existing system over to a new JS library. I tried most recently last month, but there're a bunch of engineering constraints that made it apparent, even to me, that it was a bad idea. JQuery is still used a lot for prototyping, where we don't face these engineering constraints.
- asher 17y agoThis is wonderful news; I'm really grateful to Google for opening this. We already knew that Google's major javascript apps were not using GWT. I always had reservations about GWT because I think javascript is a very nice language. (Just the language - not necessarily the DOM or implementations). While java seems like a step backwards. The main thing missing from javascript is some stricter checking, and it looks like Closure Tools provides this.