3 ms·
Whenever I consider a language for a task, I try to ask myself what advantages the language has towards my task. I don't try to think of the downsides of the la
by moron4hire 13y ago
Whenever I consider a language for a task, I try to ask myself what advantages the language has towards my task. I don't try to think of the downsides of the language at first, just the advantages.
So what does CoffeeScript give me, that JavaScript does not already have? It actually doesn't give you anything. It takes things away from JavaScript, things like explicit variable declarations (I throw "use strict" everywhere these days), and white-space independent syntax. It renames "function()" to "()->". It renames "if(condition)statement;" to "statement if condition".
Regardless of whether or not you like these things, the ultimate point is that CoffeScript, as a language, does not give me anything new, it doesn't provide anything which which I can do things any differently than JavaScript. At least for now, we need to know JavaScript, because there is too much in the wild to be ignorant of it and the transpilers aren't 100% perfect yet (leaving too many cases where you have to inspect the generated code). So why ever bother picking up another language that is, at best, a wash in terms of productivity?
On the other hand, something like ClojureScript (which I don't use, for other, unrelated reasons) gives me something. It gives me a Lisp-like language in which to write client-side applications. I know people say "JavaScript is a Lisp", but try writing good macros in raw JavaScript sometime and see how long it takes you to blow out your brains.
Similarly, TypeScript gives me static type checking, instead of having to hand-write all of my duck-typing checks. A much more explicit syntax for doing object oriented programming. A module system (though I'm not very much in love with require() style includes, I prefer namespaces).
So CoffeeScript won't likely ever be in my toolbox. Curly braces don't make my eyes cross, and I don't understand how they could ever be such a huge distraction to warrant brittle, white-space based syntax. You Pythonistas confuse the hell out of me: what are you programming that to curly brace or not to curly brace is a significant concern for you?
Note that I have no experience with Haml, so I will refrain from comments.
- bsder 13y ago> You Pythonistas confuse the hell out of me: what are you programming that to curly brace or not to curly brace is a significant concern for you? You assume this is why people use Python instead of Jaascript. It's simply what the ignorant latch on to as "different" when they need something to blather about. I make just as many cut/paste errors in Python as I do in Javascript--very few. I use Python because I can generally count on the fact that it has what I need "built-in". Last example I had about this was that I could open a promiscuous socket and suck up UDP packets quite easily from Python, while doing that in Javascript was a mess. There are lots of little examples like this. I'm actually waiting for a replacement for all of my current "go to" languages: C, Python, and Javascript. A language that does concurrency well would cause me to leap from those.
- moron4hire 13y agoSorry, I didn't mean "Python instead of JavaScript", and I also didn't mean to lump all Python users into one group. I had hoped using the term "Pythonista" would connotate a die-hard user, one of those people who argue on message boards at length of the great superiority of white-space syntax. And while I don't like white-space syntax, personally, I don't get the general debate as a whole, for the reason you mentioned: haven't made more than a handful of copy-pasta errors in the last decade. It seems like a 6-or-one-half-dozen issue, so if it's being used as a selling point of a particular language (i.e. one of the more substantial differences between CoffeeScript and JavaScript), then it's not much of a selling point at all. Your last sentence is actually very closely to my point. Yes, the languages we have aren't perfect, but there aren't any better alternatives yet. Give me an alternative and I'll gladly use it. I'm actively evaluating languages as we speak. But I need real advantage to switch from what I'm already using. A handful of regex's in a loop over stuff I already know isn't enough.
- anko 13y ago> So what does CoffeeScript give me, that JavaScript does not already have? It actually doesn't give you anything. This seems like the core of your argument against CoffeeScript, but it's fundamentally flawed. CoffeeScript fixes javascript's warts, eg. it gives consistent scoping rules, simplied/sane classes, list comprehensions, enforces per file encapsulation etc. You seem to think that CoffeeScript is about aesthetics, but that's probably the least important feature of it.