Re:Closure Mode for CoffeeScript
by jashkenas on Friday August 05, 2011 @06:24PM
(#2852045)
It is deviating pretty far from compiling to readable, standard JS, but again ... as a fork or a plugin, I'm all for it. The reason why the entire CoffeeScript source is annotated is to make variants like this easier to accomplish.
That said, statically marking your variables with "types" (where types are incredibly weak and limited in JavaScript) isn't going to be of much use to you, performance-wise. Modern engines like V8 already unbox local variables where possible, and do "hidden class" analysis to give a "type" even to regular unstructured JS objects.
Re:Closure Mode for CoffeeScript
by withjive on Friday August 05, 2011 @06:38PM
(#2852091)
What I'm after for typed annotations is integration with the closure compiler to give me static checking, so in large codebases I get that type safety, even in javascript.
That said, statically marking your variables with "types" (where types are incredibly weak and limited in JavaScript) isn't going to be of much use to you, performance-wise. Modern engines like V8 already unbox local variables where possible, and do "hidden class" analysis to give a "type" even to regular unstructured JS objects.