Is CoffeeScript used much outside of Rails? If not, wouldn't it be a better idea to focus on mastering javascript so it applies globally?
Intro to CoffeeScript
41–50 of 95 posts
Re: Intro to CoffeeScript
#42> The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. This is a mildly insulting, as is the invocation of Blub. CoffeeScript doesn't have a ton of exotic features. String interpolation, list comprehensions, and class definitions (!) are all familiar to programmers from other languages. I'm guessing that a lot of people have weighe…
Not only that, but it's JavaScript. It's JavaScript with some different tokens and shortcuts for a number of things that are missing from (some) JS runtimes and features people are used to from other languages, but it's JavaScript semantics nonetheless.
The author apparently knows this on at least a superficial level, since he pays lip service to it in his slides, but I'm not sure someone who invokes Blub in a comparison between languages that have the same semantics understands the point of the essay from which it comes.
Re: Intro to CoffeeScript
#43> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. [...] The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. Oh, wow. I've been using CoffeeScript for about a year…
Re: Intro to CoffeeScript
#44Re: Intro to CoffeeScript
#45> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. [...] The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. Oh, wow. I've been using CoffeeScript for about a year…
I love CS myself. To me, in terms of aesthetics, CS is to JS what Scala is to Java. I have been bitten by the whitespace issue that you mention though. I don't recall the circumstance but an indent that was off just a bit did not cause the compiler to complain, but did cause it to generate code that I did not intend. It took some debugging of the JS output to find that one, and it certainly gives one pause to think h…
A very simple scenario where hell is a keystroke away:
hello =
woot: 1
yay: 2
funfunfun: (x) -> x + 1
hello2 =
woot: 1
yay: 2
nowthatsfun: (x) -> x + 1
Other: y1 = (x) ->
x + 1
z1: (x) ->
x + 1
y2 = (x) ->
x + 1
z2 = (x) ->
x + 1
http://js2coffee.org/#coffee2jsThose are fairly visible here, not so much on a huge codebase (not to mention with some callback hell attached). You can write perfectly legal code that just doesn't work as expected.
//edit:
worth a read, with more trap examples http://ruoyusun.com/2013/03/17/my-take-on-coffeescript.html
Re: Intro to CoffeeScript
#46Re: Intro to CoffeeScript
#47I mostly enjoyed the slides, and I'm interested in CoffeeScript, especially since I'm going to be working a little in Node in the near future. This post is a critique on the blog post, rather than on the slide content, which was more or less fine. Too much focus placed on how those who dislike it haven't given it a proper shot. This could be true, but six paragraphs is overkill. You make a few points: A) they aren't…
It's a telling sign about a language when the language advocates have to employed negative psychological ploys to convince people (or convince themselves) to use the language.
Re: Intro to CoffeeScript
#48Earlier quoted context omitted.
I love CS myself. To me, in terms of aesthetics, CS is to JS what Scala is to Java. I have been bitten by the whitespace issue that you mention though. I don't recall the circumstance but an indent that was off just a bit did not cause the compiler to complain, but did cause it to generate code that I did not intend. It took some debugging of the JS output to find that one, and it certainly gives one pause to think h…
Compilers/interpreters complain about code that's invalid. Since the code is valid it shouldn't interfer, the problem is in the language's syntax design that's prone to shooting yourself in the foot. The design lets you mix indentations, something that Python won't let you do. A very simple scenario where hell is a keystroke away: hello = woot: 1 yay: 2 funfunfun: (x) -> x + 1 hello2 = woot: 1 yay: 2 nowthatsfun: (x)…
I think that's a matter of taste. Coming from python, I've quite enjoyed coffee-script's syntax and I've actually done something in between, using brackets for objects just because I like the readability of it, but avoiding all semicolons and taking advantage of the indentation for code blocks.
Re: Intro to CoffeeScript
#49This is a fantastic slide deck. The per slide comments below are great too. Particularly on an iPhone as you read them simultaneously. We've been using CoffeeScript for a bit over a year now and never looked back. All of our front end code is written in CS and I can't imagine writing JS again. It's just objectively better. Less code to write, easier to read, minimal cruft, and a joy to use. The only hiccup was gettin…
coffee -cwo js cs &
echo "alert 'x'" > cs/x.coffee
echo "" > x.html
open x.html
echo "alert 'x2'" > cs/x.coffee
refresh x.html
Re: Intro to CoffeeScript
#50Earlier quoted context omitted.
Compilers/interpreters complain about code that's invalid. Since the code is valid it shouldn't interfer, the problem is in the language's syntax design that's prone to shooting yourself in the foot. The design lets you mix indentations, something that Python won't let you do. A very simple scenario where hell is a keystroke away: hello = woot: 1 yay: 2 funfunfun: (x) -> x + 1 hello2 = woot: 1 yay: 2 nowthatsfun: (x)…
Your second example though exists in exact the same way in python and ruby. Some people prefer to hunt for missing comma's and brackets, others for spaces. I think that's a matter of taste. Coming from python, I've quite enjoyed coffee-script's syntax and I've actually done something in between, using brackets for objects just because I like the readability of it, but avoiding all semicolons and taking advantage of t…
btw added a link above with some more syntax gotchas.