News for hackers. Stuff that matters.
Re:Introducing Closure Tools by seiji on Friday November 06, 2009 @02:15AM (#925626)
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.

Re:Introducing Closure Tools by sh1mmer on Friday November 06, 2009 @08:47AM (#925938)
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 by gruseom on Friday November 06, 2009 @10:40AM (#926155)
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 by seiji on Friday November 06, 2009 @12:50PM (#926488)
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 by gruseom on Friday November 06, 2009 @06:33PM (#927198)
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").