5 ms·
Are there people that seriously can't just read CoffeeScript as-is? Are there seriously people that can't scan through the CoffeeScript docs in about 20 minutes
by gfodor 13y ago
Are there people that seriously can't just read CoffeeScript as-is? Are there seriously people that can't scan through the CoffeeScript docs in about 20 minutes and pick up the language more or less?
The first time I saw CoffeeScript I immediately realized, oh, fuck yes, this is obviously better, and switched over to it immediately. I was productive with it instantly. Is it really something worth spending your time arguing about in either direction? I mean, it feels like telling someone to quit using their English accent or slang when you only understand American. Reading CoffeeScript code is hardly an effort in trying to decipher a compiler, almost all of CS's constructs do exactly what you expect if you'd have to guess, and where they are not obvious the non-obvious is due to Javascript's oddities, not anything to do with CS.
A better analogy for CoffeeScript is not another language, but it's Javascript slang or shorthand. It's a practitioners dialect of the language.
- invalidOrTaken 13y agoAgreed completely. My only issue w/coffeescript is that, uh, I like clojurescript better. But clojurescript is all the things coffeescript is, just more---further from javascript, more concise, less compatible with standard js tools.
- smilekzs 13y agocoffee-script is not less compatible with standard js tools. Again, "it's just javascript" and you can use backticks in coffee to get embedded js. Common mistake made by coffee-script-nay-sayers.
- invalidOrTaken 13y agoGive me a break, you know what I mean. When you look at the page source, do you see embedded coffeescript? Can you debug in coffeescript with the standard tools? I know these things aren't possible and shouldn't be expected b/c coffee is a "compiled" language...but you can do them in javascript, and telling the vanilla js programmer that they're "exactly the same" is being less than honest.
- smilekzs 13y agoFor "vanilla js programmer", coffee-to-js-correspondance probably doesn't matter anyway. But the point of coffee is that compiler output is very straightforward. While I have to admit that tooling is far from good enough at present, I personally have no problem reading any js generated by coffee, even without source available to me. Apparently many[citation needed] coffee users can do this. What really made the "vanilla js programmer" feel uncomfortable, I speculate, is the correct way of handling javascript oddities, such as handling nulls (`?` in coffee). They are daunting -- but ignorance is no excuse. Once you start to populate these patterns yourself in your javascript, not only would you immediately recognize them in coffee-generated js, but also you'd appreciate that coffee abstracted them. I think these common points against coffee mostly apply to other compile-to-js languages such as clojure-script, where the generated code almost always made no sense to a "vanilla js programmer".
- iki23 13y agosure, using source maps in chrome dev tools, I can work directly with coffee source, the same way I work with less source instead of compiled css
- iki23 13y agochrome/ff dev tools have source maps support, I can work directly with coffee source the same way, as I work with less source instead of compiled css ... only coffeeconsole is in a separate tab via chrome extension
- elwell 13y agoHe's probably referring to debugging etc.
- shazow 13y agoI can read it but it's a struggle. Much like reading Ruby, for someone who comes from Python. The syntax doesn't quite make sense to me and its usage varies between authors—a bunch of things are optional and used unpredictably (parenthesis, lambdas, indent-alignment). Despite the Pythonish indent-based blocks, CoffeeScript is very much Ruby-like in syntax and culture. From my experience, fluent Ruby readers enjoy CoffeeScript much more. Regardless, the point is that CoffeeScript != JavaScript. Doing things like answering JavaScript questions in CoffeeScript is simply inconsiderate and not very useful—much like answering Python questions in Ruby. It's true—I could go ahead and learn CoffeeScript and become more fluent at it if I wanted to, but I don't. I actually like JavaScript as it is, especially the newer specifications. Same way I choose to continue using Python rather than learn Ruby more thoroughly so that I can benefit from random Ruby answers to my Python questions.
- gfodor 13y agoI think making analogies about this is hard. Programmers are used to thinking about languages as Big Things that change the way you think. This is not that. I would encourage you to dedicate a block of about 30 minutes to port a single piece of non-trivial JavaScript code to CoffeeScript. You'll almost certainly neutralize any hangups you have in this short period.
- vinceguidry 13y agoThe first time I tried to do this, it forever changed the way I write Javascript.
- tommaxwell 13y agoVery solid points. As someone that also enjoys JS as-is, it really frustrates me when people use CoffeeScript in JS answers and tutorials.
- lloeki 13y agoWile I don't consider them to be solid points (see my reply), yours is a solid one: when one asking a question (say on SO) asks speaking in JS tongue, I'd expect the person answering to reply in JS, simply out of courtesy. And conversely.
- mattdw 13y ago> The first time I saw CoffeeScript I immediately realized, oh, fuck yes, this is obviously better, and switched over to it immediately. I was productive with it instantly. Which is fine for you. But I tried it for a project then ditched it, because it didn't justify the extra tooling required in my development pipeline, and because there are ambiguities and inconsistencies in the syntax and the language, and yes, occasionally it's actually worse than Javascript. Which is only to say that not everyone fits into a "doesn't know CoffeeScript"/"loves CoffeeScript" dichotomy.
- gfodor 13y agoThe point wasn't that everyone should use it. The point was that it was trivial to pick up and use so I'm often surprised when people complain about how difficult it is to read. If I handed you a piece of CoffeeScript and you literally had never read the docs, but are a competent programmer who knows Javascript well, it'd be surprising if you couldn't just read it as-is and know what it's doing since you know it's just an alternative syntax for javascript.
- cnp 13y agoI don't mean to sound dense, but who isn't using some kind of build system these days with their JavaScript? "Extra Tooling" really is quite trivial given the general de-facto standards that are now in place. As far as the ambiguities and inconsistencies go, that I can understand.
- elwell 13y agoThis might be shortsighted, but maybe the fact that Discourse was not "getting as many contributions as they expected simply because their JavaScript was obfuscated behind Coffee" is a good thing. Surely, the higher quality contributors prefer CoffeeScript. ;)
- iki23 13y ago+1, CS can be learned in few hours and any questions on what each constuct produces can be quickly resolved in coffeeconsole for chrome Verification: lead development of 50MD and 300MD mobile html5 apps for major UK TV's and even people who did see CS first time were able to pick it up quickly. I had literally about 5 cases when I had to answer some chat questions on how CS works, and about the same count when I corrected/optimized some CS usage in a code review. The productivity gain was impressive. In ducktyping, but esp. in __understanding__ the code quickly. We're not going back.