Live data from Hacker News

Introducing Closure Tools

googlecode.blogspot.com

51–60 of 71 posts

Re: Introducing Closure Tools

#51
post #31

Earlier quoted context omitted.

Here'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 > 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)

I 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.

Out of curiousity, I threw together a quick comparison using SlickSpeed and the latest jQuery/Prototype frameworks.

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.

Re: Introducing Closure Tools

#53
post #41
post #32

Earlier quoted context omitted.

Well, 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.)

Haskell does not semantically have closures at all, because functions have only their arguments -- no scope to close over. Lexically, there's where clauses to scope function definitions, but that gets desugared very early, and is really not the same thing at all anyway (the name binding is completely static).

Of course Haskell has closures, there's always a scope to close over:

f x = (\y -> x + y)

Re: Introducing Closure Tools

#54
post #48

Earlier quoted context omitted.

I 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?

Closure 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.

This 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.

Re: Introducing Closure Tools

#55

Earlier quoted context omitted.

"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.

I 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.…

"what else are you gonna call it?"

How about "Armadillo"?

Re: Introducing Closure Tools

#56
post #55

Earlier quoted context omitted.

I 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.…

"what else are you gonna call it?" How about "Armadillo"?

Years ago, i wrote a compressor for javascript.

I called it "Arnold" because it was strong and squeezed javascript into a smaller shape.

Re: Introducing Closure Tools

#57
post #33
post #32

Earlier quoted context omitted.

Well, 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.)

A 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…

Python 3 has read-write closures. Check out the nonlocal declaration.

Re: Introducing Closure Tools

#58
i 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?

Re: Introducing Closure Tools

#59
post #48

Earlier quoted context omitted.

I 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?

Closure 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.

If the Closure "compiler" changes the behavior of a program, that means it's generating incorrect code. Can you give an example?

Re: Introducing Closure Tools

#60
post #58

i 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?

Google 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).
Post reply on HN