Live data from Hacker News

CoffeeScript: The beautiful way to write JavaScript

amix.dk

31–40 of 88 posts

Re: CoffeeScript: The beautiful way to write JavaScript

#31
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

Chris Okasaki has some high praise for languages implementing indentation as part of the syntax http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-i...

Personally I think Coffeescript is a big step forward. A pity it will likely never gain enough momentum to see native implementations on the major browsers.

Re: CoffeeScript: The beautiful way to write JavaScript

#32

Earlier quoted context omitted.

Syntactic sugar is all CoffeeScript can ever be. Is pretty syntax better than common-use syntax? (To be clear: I don't have a strong opinion. I'm curious what the community thinks the value proposition for CoffeeScript, HAML, etc is.)

> Is pretty syntax better than common-use syntax? What do you mean?

Javascript is understood by most developers these days. CoffeeScript is pretty.

(Edit: I don't think that "pretty" is a bad thing. I just... when is it the most important thing, or even high up on the priority list? Pretty isn't bad, but if it means learning an entirely new syntax and immature toolchain, its value for all but personal projects is unclear to me. I see that others value it differently, and I'm trying to understand why.)

Re: CoffeeScript: The beautiful way to write JavaScript

#33
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

Is your only basis for feeling that people that like CoffeeScript don't "get" JavaScript the `class` syntax? If that's the case, it's a minor feature of CoffeeScript. I'd say the rest of the features it offers fall on the dynamic/functional side of things more than the strong+static typed/classical OOP side ( list comprehensions, splats, treating everything as an exression, etc.).

Re: CoffeeScript: The beautiful way to write JavaScript

#34
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

[deleted]

Re: CoffeeScript: The beautiful way to write JavaScript

#36
post #2

I love CS, but this article doesn't seem to have much useful content that isn't arleady in the CS docs: http://jashkenas.github.com/coffee-script/

Nope, but I read this article and then read the CS docs -- which I wouldn't have done if this article wasn't posted.

Re: CoffeeScript: The beautiful way to write JavaScript

#37
post #18

Earlier quoted context omitted.

In this case, the semantics were already decided: CoffeeScript was intended to map transparently to JavaScript. Each change to semantics would add complexity to that mapping.

Syntactic sugar is all CoffeeScript can ever be. Is pretty syntax better than common-use syntax? (To be clear: I don't have a strong opinion. I'm curious what the community thinks the value proposition for CoffeeScript, HAML, etc is.)

> Is pretty syntax better than common-use syntax?

IMHO, in this instance, absolutely yes. I enjoy using CoffeeScript in a way I've never enjoyed JS. It's easier to write and easier to read. For example, compare:

    x = this.x;
    y = obj.map(function(z) {return z + x;});
with

    y = obj.map z => z + @x
I also find it of great benefit if I'm coding elsewhere in Ruby (for example, if I'm coming from some Ruby coding I'm prone to forgetting return statements in my JS at key moments).

Re: CoffeeScript: The beautiful way to write JavaScript

#38

Earlier quoted context omitted.

> Is pretty syntax better than common-use syntax? What do you mean?

Javascript is understood by most developers these days. CoffeeScript is pretty. (Edit: I don't think that "pretty" is a bad thing. I just... when is it the most important thing, or even high up on the priority list? Pretty isn't bad, but if it means learning an entirely new syntax and immature toolchain, its value for all but personal projects is unclear to me. I see that others value it differently, and I'm trying t…

You say "pretty" like it's a bad thing...

Re: CoffeeScript: The beautiful way to write JavaScript

#39
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

> I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript

I disagree with this (though I agree with the rest of your post). The people that like CoffeeScript (and StratifiedJS and other projects like ObjectiveJ) are generally people that do get JavaScript really well. They just want to make it better.

The problem with CoffeeScript and the others is that they are not JavaScript. CoffeeScript is pretty straightforward in that it hardly even looks like JS and just compiles down to it, but others pretend to be JS but introduce new structures that make them all completely different languages (and do source transformation using JS in the browser).

If you don't know the transformations and you don't know JS very well, all these languages on top of JS will leave you stranded the second something goes wrong anywhere in the stack.

I'd like to see JS adopt some core structures for concurrency, namespaces and more CommonJS stuff instead of adding let, generators and comprehensions - which are nice, but mostly just fluff because you can do all those using the core language already and they're details nobody really cares about.

Re: CoffeeScript: The beautiful way to write JavaScript

#40

Out of curiosity: What's with today's obsession over beautiful syntax? Shouldn't we strive for beautiful semantics, instead?

Absolutely, but the idea here is a bit different. JavaScript is a language that we're stuck with for the entire foreseeable future of the web, for better or for worse ... and CoffeeScript is a conscious attempt to try and work within that limitation. Unless you're willing to take the significant performance hit of running an interpreter on top of JavaScript, you have to stick fairly close to JavaScript semantics. Tha…

Interesting; I wasn't aware that CoffeeScript makes some semantic improvements too. Everything is an expression is truly value-add.
Post reply on HN