Basically when enabled it will rewrite normal property access, e.g: `myObj.foo` to something like `a.b` but wont shorten string literal access, e.g `myObj['foo']` just becomes `a.foo` which you would use for any API's you want to export.
For a real-world example I use string literals for declaring jquip's public API:
p['removeAttr'] = function(name){
return this['each'](function(){
if (this.nodeType == 1) this.removeAttribute(name);
});
};
Which closure advanced rewrites to: q.removeAttr=function(a){return this.each(function(){this.removeAttribute(a)})};
Original: https://github.com/mythz/jquip/blob/master/dist/jquip.all.jsCompiled: https://github.com/mythz/jquip/blob/master/dist/jquip.all.cl...
https://developers.google.com/closure/compiler/docs/api-tuto...
Like anything else, there are tradeoffs, and Closure asks that you restrict yourself to a more predictable set of patterns in return for the benefits it offers.
One of the nice things about ClojureScript is that the compiler will output compatible code, so you don't even really have to think about it (except when doing JS interop). If you write valid ClojureScript, it Just Works.
Is it limited to obvious stuff like things after a "return;" statement that cannot run? Because I don't see how it could remove unused functions when you can invoke them in such indirect ways: myobj['f'+'oo']();