r/programming • • Jul 25 '13

CoffeeScript's Scoping is Madness

http://donatstudios.com/CoffeeScript-Madness
207 Upvotes

315 comments sorted by

View all comments

Show parent comment

4

u/ikilledkojack Jul 25 '13

What's the problem with writing vanilla Javascript? Perhaps I don't see it as an issue is the reason why I see no benefit to learning Coffeescript.

5

u/yogthos Jul 25 '13

I don't know how many of these apply to Coffeescript, but there are certainly things that can be improved on JavaScript.

Here's a few reasons I use ClojureScript:

  • proper namespacing support
  • libraries
  • sane variable hoisting
  • arbitrary keys in maps
  • persistent data structures
  • comparison by value, including complex data structures, directly facilitated by the above
  • much simpler rules and syntax
  • multiple arity functions
  • named parameters
  • uniform iteration mechanics for all native types
  • proper lexical scope for clousres
  • lazy sequences
  • macros

2

u/[deleted] Jul 25 '13
  1. JavaScript does have a bunch of technical issues and CoffeeScript insulates you from most. Here's some of it.
  2. Too many different interpreters. Increasingly a historical argument, thankfully, but cross-browser compatibility has been a pain. Again, CoffeeScript insulates you, at least to a degree.
  3. It just doesn't feel comfortable. I've seen too many cases of semantic trickery and nested function(){}s that render code ineligible. I feel better writing Pythonesque languages. That's not a technical argument, just personal preference. Just like I use HAML and such, I'd easily use a translator from a style I like to JS, even if it did nothing else.

2

u/cashto Jul 25 '13 edited Jul 25 '13

What are y'all doing in here?

We're writing CoffeeScript. And you don't want no part of this shit!

You know what, I don't want to be tied to no browser, I can't write no browser-specific code.

IT'S NOT PLATFORM SPECIFIC!

I'll have to write some complicated syntax?

IT'S NOT VERBOSE!

Okay, well, I don't want to be unable to do anything I can do in JS ...

IT'S NOT A SUBSET OF JAVASCRIPT!

It's not going to make me want to write JavaScript, will it?

IT MAKES JAVASCRIPT EVEN BETTER!

Sounds kind of hard to learn?

IT'S THE EASIEST LANGUAGE THERE IS!

Hmm.

You don't want it! Get out of here Dewey!