CoffeeScript: two sugars, no bitter aftertaste(engineering.freeagent.com)
engineering.freeagent.com
CoffeeScript: two sugars, no bitter aftertaste
http://engineering.freeagent.com/2012/01/30/coffeescript-two-sugars-no-bitter-aftertaste/
2 comments
What about browser support ? No stack trace, no proper file:lineno for exceptions, the code you put in the console is not the one you work with. Those are essential to my work flow, and I guess, surely not everyone, but many other nevertheless. This is the same problem we have with those fancy css processors.
If this is the sticking point that's preventing you from giving CoffeeScript a try -- don't let it.
Not having source map support in browsers is certainly less than ideal, and yet... 95% of the folks who raise this issue have never tried CoffeeScript, and 95% of the people who have tried CoffeeScript will tell you it's not an issue.
Not having source map support in browsers is certainly less than ideal, and yet... 95% of the folks who raise this issue have never tried CoffeeScript, and 95% of the people who have tried CoffeeScript will tell you it's not an issue.
The nice thing with coffeescript is that it complies to very readable Javascript with an almost one to one matching between lines in coffscript and lines in javascript. So as such it is pretty trivial to find the corresponding line in your coffescript file, given a line in your javascript file.
I agree that matching up line numbers is usually pretty trivial, although I also see how this complicates the workflow for people. To make matching lines even easier, I've written this tool: https://github.com/showell/CoffeeScriptLineMatcher
It's a valid concern if that's how you develop, but in my experience my tests catch any issues before I get anywhere near the browser console.
That's the same criticism that gets thrown at CoffeeScript every time its ever being debated. And the answer is always the same, see @dagw reply.
They are coming, they have shown up in nightlies of chrome.[1]
[1] http://peter.sh/2012/01/css-selector-profiler-source-mapping...
[1] http://peter.sh/2012/01/css-selector-profiler-source-mapping...
Nitpick:
"What’s happened? The required_field_names variable has been scoped by var, and the whole script has been wrapped in a namespace."
It's been wrapped in a closure. Namespace, to me, implies that it's been stashed somewhere easily accessible in the future.
"What’s happened? The required_field_names variable has been scoped by var, and the whole script has been wrapped in a namespace."
It's been wrapped in a closure. Namespace, to me, implies that it's been stashed somewhere easily accessible in the future.
It's just a space that contains names. The result is actually pretty similar to C++'s anonymous namespaces, which is why I guess I didn't blink at the name.
Yeah, I'll give you that :)
The article is adapted from something I wrote for .net magazine, so the audience perhaps wouldn't have been familiar with the terminology.
The article is adapted from something I wrote for .net magazine, so the audience perhaps wouldn't have been familiar with the terminology.