4 ms·
Because it is badly designed? Or because it is too different from js?
by jamesra 15y ago
Because it is badly designed? Or because it is too different from js?
- masklinn 15y agoBecause it's kind-of a mish-mash, and syntactic elements imported from other languages (I know) tend to behave differently in subtle ways, usually making them worse or weird. Also having a single token change so much meaning (fat vs thin arrow) feels icky and hard to read/notice.
- Cushman 15y agoThat's a fair perspective, although what you call a "mish-mash" I'd call borrowing the best syntax for every feature :) The syntax came out of a community effort over the course of many months, and a lot of thought went into the decisions that were made. (And of course it's still under development!) Since you mentioned the => operator in particular, I'll defend it briefly-- it's a feature JavaScript sorely needs, and in the situations where it's useful it's a godsend, turning a pile of ugly JS into a single operator. The thing it describes is a little complex semantically, but in practice it's very straightforward, and in the cleaner environment of CoffeeScript it stands out well. It does seem like a small difference, but do you mix up == and -= much? Same deal. Visually speaking it actually makes a lot of sense: -> indicates a vanilla, unbound function, while => indicates a bound function whose context equals the one it's defined in. I know I'm a bit of a fanboy, but if you do a lot of JavaScript I'd encourage you to at least give CoffeeScript a second chance over a weekend sometime; it's the same, normal JS semantics you know and love, but you get to use all the futuristic shortcuts and clean syntax of a modern scripting language, and it outputs nice, readable, compliant JavaScript. (Say goodbye to JSLint!) That's well worth the minimal learning curve, in my opinion of course.
- masklinn 15y ago> Since you mentioned the => operator in particular, I'll defend it briefly-- it's a feature JavaScript sorely needs, and in the situations where it's useful it's a godsend, turning a pile of ugly JS into a single operator. Oh I understand the need for it, my issue is not with the fat arrow in and of itself, but in the fat arrow and the thin arrow. > It does seem like a small difference, but do you mix up == and -= much? Same deal. Well... 1. I rarely if ever use either, and 2. they're generally used in different contexts, I would never use `-=` as part of a wider expression (unless I wanted to fuck with the reader of the code, who is usually me) whereas `==` is not very useful outside of a conditional expression (or at least as a parameter to something else, like a function). The thin and fat arrows, by comparison, are used in the exact same contexts. This makes them much more error prone. > That's well worth the minimal learning curve, in my opinion of course. I don't mind the learning curve, I mind that I don't really like the way the syntax fits together (or does not). Though, to be fair, I also don't like the extra tooling or having to debug different code than was written.
- Cushman 15y ago> The thin and fat arrows, by comparison, are used in the exact same contexts. This makes them much more error prone. You can say that, but in practice it doesn't really happen. They look somewhat different, they do somewhat different things. It's programming, ya know? Not that I'm trying to make you like it or anything-- of course you have the right to your own aesthetic sensibility.
- coreyrecvlohe 15y agoYou've obviously never used CoffeeScript.
- masklinn 15y agoYou're also a Go user are you not? If you're not, you should start, you've already got the reaction down pat.
- deleted 15y ago[deleted]
- philjackson 15y agoWhat's any language, if not a mish-mash of its predecessors?
- vidarh 15y agoBecause it looks like the type of syntax a Haskell developer might create...
- vidarh 15y agoDownvoted for giving an honest answer to the question I was asked. Classy. This place is becoming more and more like Reddit.