Live data from Hacker News

CoffeeScript is not a language worth learning

github.com

51–60 of 132 posts

Re: CoffeeScript is not a language worth learning

#51

Earlier quoted context omitted.

You missed the rest of the essay, wherein Raganwald described how CoffeeScript “features” are a shorthand for common JavaScript design patterns, forcing everyone to use the same patterns in the same way. [In other words, he answered your specific comment at great length, rendering your criticism of one out-of-context quotation a bit weak, eh?] Specifically, most major JavaScript projects have some kind of class imple…

Class inheritance is not a common JavaScript design pattern. It's a hack, used by a minority of JavaScript developers, in a minority of projects. The crux of the argument is that when you write CoffeeScript you think in JavaScript. But I absolutely never think about overriding a parent function in JavaScript. In CoffeeScript this is actively encouraged. Like I said, as other ideas like await/defer become more mature…

    > But I absolutely never think about overriding a parent function 
    > in JavaScript. In CoffeeScript this is actively encouraged.
Unfortunately, if you never think about overriding a parent's implementation of a function in JavaScript -- all that means is that you willfully don't use prototypes. The famous "prototype chain", by which object-orientation in JavaScript is accomplished, is all about overriding versions of parent properties.

    > Class inheritance is not a common JavaScript design pattern. 
    > It's a hack, used by a minority of JavaScript developers, 
    > in a minority of projects.
Nope, it's deeply ingrained in all object-oriented JavaScript that uses prototypes. What are the built-in String, Function, RegExp, Number, Array, and Object, if not classes?

Re: CoffeeScript is not a language worth learning

#52
post #20

TL;DR: Coffeescript should be seen as a way to enforce good Javascript style, and as such it does a decent job. That's an interesting and very defensible PoV. However, even considered as such, it has some serious warts: * It has no clearly-defined semantics: it's an accretion of rewriting tricks, and as such, it's often very hard to predict how two tricks will interact together, especially when they involve indentati…

For the curious, check out fab13n's initial work towards one such refactoring / implementation, here:

https://github.com/fab13n/parsec-coffee-script

Re: CoffeeScript is not a language worth learning

#53

> Ryan Florence argues that if people use CoffeeScript to write JavaScript programs, maintenance will be a nightmare: I posted that article a little prematurely and more as a rant for my co-workers. It was a bit misunderstood (and it blew up online before I even knew it so I didn't bother editing). My point in that quote was that bad CoffeeScript is worse than bad JavaScript. Good CoffeeScript is better than good Jav…

> Good CoffeeScript is better than good JavaScript. Bold statement, explanation?

I find really well-written CoffeeScript easier to comprehend and scan, even though the community at large believes I hate the stuff entirely (I don't).

I'm just not sure if it's enough to make up for a less-than-optimal debugging experience, especially considering that most of us don't write really excellent code all the time.

Re: CoffeeScript is not a language worth learning

#54
post #40

> None of these things are "language features" that compile from a language that has them—CoffeeScript—into a language that doesn't have them—JavaScript. This is inane. Haskell used to compile to C. Were they not "language features"?

Clearly my writing is obtuse. Haskell has a language features—lazy evaluation for example—with no equivalent in C. Nothing about lazy evaluation compiles more-or-less 1:1 into C code, it’s a program-wide transformation. CoffeeScript’s features are all JavaScript features, it’s a simple translation from some shorthand into some other shorthand. CoffeeScript is like the LET macro in ur-Scheme. Powerful, handy, but not…

    > CoffeeScript’s features are all JavaScript features, 
    > it’s a simple translation from some shorthand into 
    > some other shorthand.
This isn't entirely accurate -- in the sense that current CoffeeScript semantics can't be implemented as a series of "find-and-replace" operations into JavaScript. Some of the areas in which the AST transformations become more involved are:

* Converting arbitrary statements into expressions.

* Destructuring assignment, when mixed with splats and soaks.

* Chains of soaked invocations, like:

      value = one?().two?().three?()
* Class bodies as blocks of executable code.

Re: CoffeeScript is not a language worth learning

#55

Earlier quoted context omitted.

Class inheritance is not a common JavaScript design pattern. It's a hack, used by a minority of JavaScript developers, in a minority of projects. The crux of the argument is that when you write CoffeeScript you think in JavaScript. But I absolutely never think about overriding a parent function in JavaScript. In CoffeeScript this is actively encouraged. Like I said, as other ideas like await/defer become more mature…

> But I absolutely never think about overriding a parent function > in JavaScript. In CoffeeScript this is actively encouraged. Unfortunately, if you never think about overriding a parent's implementation of a function in JavaScript -- all that means is that you willfully don't use prototypes. The famous "prototype chain", by which object-orientation in JavaScript is accomplished, is all about overriding versions of…

There are a half a dozen different implementations of class inheritance in JavaScript. However no one writing a JS library is going to ask the consumer to extend one of their objects. This is what inheritance is all about. In Java you extend everything. Backbone.js is the only popular JS library I can think of which has their users use this pattern. It doesn't make since most of the time because:

1) The use of the pattern is not common in the js community. 2) If someone does use the pattern, they might be using a different implementation.

That you can override an Object's toString is not what we're talking about here jashkenas. We're talking about creating an Animal class and extending it with Horse.

Re: CoffeeScript is not a language worth learning

#56
post #29

I feel bad saying this, because I respect raganwald greatly and I usually enjoy his writing, but this post is somewhere on the border between facile and false. For example: > CoffeeScript has lots of more subtle transformations up its sleeve, like comprehensions, destructuring assignment, splats, or the "fat arrow" some rail against. Here's the secret to understand: None of these things are "language features" that c…

Any source language can be said to be a simple transformation of its target language Not always. There are a number of language features that have non-local implications, such as pattern matching, lazy evaluation, continuations, or exceptions. If you implement such a feature on top of a language that doesn’t have it, you will have decidedly complex transformations. I agree that it’s overly simplistic to suggest that…

Nit: I think pattern matching would be local the way you are using the term; pattern matching is(/would be) implemented right at the site you use it with some form of if/else clauses that would be verbose, but obviously related to the original code. Your other three examples definitely involve large-scale "non-local" source transformation all over the place to implement them.

I say this because it took me a moment to figure out how those four things went together.

Re: CoffeeScript is not a language worth learning

#57

Earlier quoted context omitted.

> Good CoffeeScript is better than good JavaScript. Bold statement, explanation?

I find really well-written CoffeeScript easier to comprehend and scan, even though the community at large believes I hate the stuff entirely (I don't). I'm just not sure if it's enough to make up for a less-than-optimal debugging experience, especially considering that most of us don't write really excellent code all the time.

So now we need Coffeescript, The Good Parts.

Re: CoffeeScript is not a language worth learning

#58

Earlier quoted context omitted.

> Good CoffeeScript is better than good JavaScript. Bold statement, explanation?

major fail

As a CoffeeScript - and JavaScript - fan, I must say that TJ's JavaScript is among the best code I've seen, in any language.

Re: CoffeeScript is not a language worth learning

#59
post #20

TL;DR: Coffeescript should be seen as a way to enforce good Javascript style, and as such it does a decent job. That's an interesting and very defensible PoV. However, even considered as such, it has some serious warts: * It has no clearly-defined semantics: it's an accretion of rewriting tricks, and as such, it's often very hard to predict how two tricks will interact together, especially when they involve indentati…

From the coffeescript website: CoffeeScript is a little language that compiles into JavaScript. Underneath all those awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. Coffeescript has never presented itself otherwise. What causes the confusion is pointless discussions about semantics and peo…

> Coffeescript has never presented itself otherwise.

My point was not to disparage the author, his intentions, his lucidity, nor even the resulting language. When people receive something packaged as a compiler (a file->file traduction tool to invoke from the command line and to include in building scripts), they naturally understand it as a compiler, and judge its qualities as a compiler.

And by "compiler", I mean the informal concept that people spontaneously put behind gcc or javac, not any attempt to formally classify a kind of data conversion tool. Among associated expectations, there's this idea that the abstraction provided by the compiler doesn't leak: you generally don't need to know about ASM/bytecode while using GCC/javac. CS doesn't shield you from the generated JS, and as such, it falls short of most people's expectations about a compiler.

Looking at these expectations from a different perspective, as does Raganwald, is very interesting.

Re: CoffeeScript is not a language worth learning

#60

I still believe that people love or hate CoffeeScript mainly because of the differences in syntax: http://franklinchen.com/blog/2011/11/06/the-real-reason-for-...

Of course they do; it's the same semantics under the hood. CS is mostly different tokens plus some sugary shortcuts. That doesn't mean that it's not OK to prefer it over JavaScript (or vice versa) if you find those differences make you happier about coding in it.

Exactly what I was saying in my blog post: that it's all OK, and everyone should just get along already.
Post reply on HN