|
|
|
|
|
by jfager
5539 days ago
|
|
Those 'each' examples aren't sugar, they're functions. They don't produce code, they are code. To make them faster, you have to use the more verbose for loops in their place. Sure, a JS developer could write out the for loop each time, but doing so is less readable and more error prone. You could even stick with the each approach and replace with for-loops after profiling, but then you have to actually do the profiling and rewrite your code to get the benefit. The JavaScript that gets produced by CoffeeScript is pretty predictable and way more readable than I expected it would be when I first started using CS. Once you use it for a while, you pretty much know what your underlying JS is going to look like, and if you ever do run into any truly hairy sections that just have to be JS, you can write that JS in the same file. |
|