6 ms·
I don't know any thing about CoffeeScript, but static analysis tools like the Google Closure Compiler can help you take care of global variable problems and a w
by euroclydon 16y ago
I don't know any thing about CoffeeScript, but static analysis tools like the Google Closure Compiler can help you take care of global variable problems and a whole lot more. Using Closure Compiler, you are forced to document your code with their enhanced version of jsDocs, so CC will make sure that if your method returns null or a list of strings, that anywhere that method is used, you don't try to treat the returned value as a string or object, for instance.
How does coffee script play with existing object oriented JS libraries? Is there compile-time type checking?
- Cushman 16y agoThe golden rule of CoffeeScript is: "It's just JavaScript". The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. http://coffeescript.org http://coffeescript.org
- neimado 16y ago1:1? This is so much bullshit i don't even know where to start.
- randito 16y agoOne of the niceties of CoffeeScript generated code is that it's totally readable and idiomatic Javascript with a dose of JSLint on top. To misquote the "Pragmatic Programmer" book... don't use wizard code you don't understand. The opposite applies in my opinion.
- cpeterso 16y agoI always thought it would be cool if CoffeeScript's generated JS code added Closure Compiler annotations, such as @const and @param types. Let the user minify/optimize the generated JS using their favorite tools. https://code.google.com/closure/compiler/docs/js-for-compiler.html https://code.google.com/closure/compiler/docs/js-for-compile...
- rudiger 16y agoAutomatically annotating JavaScript code for JSDoc would really helpful.
- munificent 16y agoThis fork of CoffeeScript does: https://github.com/jstrachan/coffee-script/blob/master/TypeAnnotations.md https://github.com/jstrachan/coffee-script/blob/master/TypeA.... I for one would also love it if this got rolled into mainline. I use Closure at work, and I'd love to be using CoffeeScript with it.
- cpeterso 16y agoThanks! I hadn't seen this "UberScript" before, though I was kinda hoping the Closure annotations could be inferred "for free" without changes to the CoffeeScript language. <:)