Live data from Hacker News

Introducing Closure Tools

googlecode.blogspot.com

61–70 of 71 posts

Re: Introducing Closure Tools

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

Re: Introducing Closure Tools

#62
post #59
post #48

Earlier quoted context omitted.

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?

Check out http://code.google.com/closure/compiler/docs/api-tutorial3.h...

(short version: inconsistencies between Closure renaming my_object.attribute to a minified a.a while in other places you use my_object['attribute'] which it can't minify to be a.a. You end up with a.a = 3 and a['attribute'] = {something else}).

Re: Introducing Closure Tools

#63
post #33

Earlier quoted context omitted.

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.

The nonlocal statement causes the listed identifiers to refer to previously bound variables in the nearest enclosing scope. [1]

While certainly a big improvement, we still can't access variables in arbitrary scopes, just local, nearest non-local, and global. To me, this seems a significantly more complex way of specifying variable scope than just declaring it explicitly.

1. http://docs.python.org/dev/3.0/reference/simple_stmts.html#t...

Re: Introducing Closure Tools

#64
post #41

Earlier quoted context omitted.

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)

That's still just high-level lexical sugar - the 'scope' is not captured, just rewritten. After desugaring, there is no scope left, even lexically.

It's completely different from a 'closure' in a language that has variables.

Re: Introducing Closure Tools

#65
post #62
post #59

Earlier quoted context omitted.

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

Check out http://code.google.com/closure/compiler/docs/api-tutorial3.h... (short version: inconsistencies between Closure renaming my_object.attribute to a minified a.a while in other places you use my_object['attribute'] which it can't minify to be a.a. You end up with a.a = 3 and a['attribute'] = {something else}).

Ah. This is a classic problem with transforming JS. We've run into something similar with Parenscript (but were able to correct it, rather than say "just don't write code that does X").

Re: Introducing Closure Tools

#66
post #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).

MS 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!

Re: Introducing Closure Tools

#67
post #40
post #28

Earlier quoted context omitted.

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

It'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.

Depressing? Don't talk to me about depressing. I'll be over in the corner rusting for the next nine million years.

-- Marvin

Re: Introducing Closure Tools

#68
post #43

Earlier quoted context omitted.

The overlap of people interested in Clojure and people interested in Closure is rather small. This entire thread is evidence against that point.

Unless HN somehow selects for people interested in lisp-like things...

...who also develop web sites...

Re: Introducing Closure Tools

#69
post #29
post #26

Wow, 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.

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

IIRC, 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!

Re: Introducing Closure Tools

#70
post #2

What an unfortunate name. Perhaps, in the confusion, it will help to actually promote Rich Hickey's wonderful work.

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

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

Post reply on HN