Live data from Hacker News

CoffeeScript: The beautiful way to write JavaScript

amix.dk

51–60 of 88 posts

Re: CoffeeScript: The beautiful way to write JavaScript

#51

Earlier quoted context omitted.

Well it seems your assumption that "pretty" is purely a luxury, something that's nice to have but serves no practical purpose other than aesthetic satisfaction. Personally I disagree. I think a programming language is not like a car, at least not in that with a car whether it's pretty or not has no practical effect on the utility of the car. You are using the computer language to express your own ideas, and to formul…

My perspective is a little more subtle than that. To clarify: "Pretty" is great -- desirable, even. But if "pretty" comes at the cost of using immature tools that may slow me down, or at the cost of forcing my development team to learn a new syntax just because I believe it's "pretty" -- well, that's a harder value proposition. That's what I'm trying to get at with all this. It sounds like, to you, the level of "pret…

Pretty to me is the difference in being excited about writing code and feeling dead inside. Yes, a bit hyperbolic but I really don't like even looking at JS at this point. CS makes me more efficient for this reason and for the improved syntax. I feel the same way about Sass/Compass vs CSS, BTW.

How long do you expect it to take your team to learn the syntax? I would expect anyone with JS experience to have this [1] page open and be able to immediately start writing code and have it down in no time.

1. http://jashkenas.github.com/coffee-script/

Re: CoffeeScript: The beautiful way to write JavaScript

#52
post #13
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 don't think many use CoffeeScript because they don't "get" JavaScript. I think they use CoffeeScript because it gives them a much better JavaScript and makes them more productive and "happy".

I don't agree with your opinion at all. Your claim that coffeescript is somehow 'better' than javascript is just false. You prefer one syntax, fine, but don't assume that it is somehow 'better'. I prefer Javascript. I do not prefer Coffeescript at all, and I get javascript, and have gotten it for 14 years.

Re: CoffeeScript: The beautiful way to write JavaScript

#53
post #25
post #17

Earlier quoted context omitted.

I'm struggling to think of something I can do in Javascript, but not CoffeeScript. Can you give an example?

Because of whitespace and line break sensitivity you can't dynamically generate serialized CoffeeScript (unless delicately handled) because it won't compile.

Why would you even do that? You could just dynamically generate serialized JS and load it with CoffeeScript.

Re: CoffeeScript: The beautiful way to write JavaScript

#54

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

Javascript's semantics already suck and CoffeeScript is kind of stuck with that. Might as well focus on what they can make better.

Re: CoffeeScript: The beautiful way to write JavaScript

#55

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

Also, with a language like javascript, shouldn't we worry more about faster performance then beautiful syntax.

Absolutely, and CoffeeScript worries about your JS performance for you, when it can. In my personal experience, translating JS to Coffee tends to speed up the performance of the resulting script, due to the optimizations the CoffeeScript compiler adds.

To be specific, the main speedup I tend to get is this: If I'm working with JS, I'll tend to use a "forEach" function frequently, for looping over lists:

    list.forEach(function(item){ item.transform(); });
In CoffeeScript, you'd write it like this:

    item.transform() for item in list
... and instead of the slow "forEach" function, you get a much faster native "for" loop.

Re: CoffeeScript: The beautiful way to write JavaScript

#56
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 agree with everything you are saying. Coffeescript really is for people who prefer a ruby/python syntax, and who just don't like javascript's syntax.

BEATUY IS IN THE EYE OF THE BEHOLDER people! Just because you find javascript 'ugly' and coffeescript 'beautiful' doesn't actually mean everyone agrees with you. I think Javascript is beautiful and I've been coding it for 14 years. I have no need to replace the syntax, or complicate my development tools, or make debugging any more complicated that it already is.

Coffeescript evangelists are like born-agains who try to convert every man woman or child to their newfound religion because their god is the true god. It's annoying really.

Re: CoffeeScript: The beautiful way to write JavaScript

#57
post #51

Earlier quoted context omitted.

My perspective is a little more subtle than that. To clarify: "Pretty" is great -- desirable, even. But if "pretty" comes at the cost of using immature tools that may slow me down, or at the cost of forcing my development team to learn a new syntax just because I believe it's "pretty" -- well, that's a harder value proposition. That's what I'm trying to get at with all this. It sounds like, to you, the level of "pret…

Pretty to me is the difference in being excited about writing code and feeling dead inside. Yes, a bit hyperbolic but I really don't like even looking at JS at this point. CS makes me more efficient for this reason and for the improved syntax. I feel the same way about Sass/Compass vs CSS, BTW. How long do you expect it to take your team to learn the syntax? I would expect anyone with JS experience to have this [1] p…

I write javascript and I don't feel 'dead inside'. I love writing javascript, and I code all day every day. Just because you hate it doesn't mean it's bad.

Re: CoffeeScript: The beautiful way to write JavaScript

#58
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…

CoffeeScript is javascript so prototypal objects still work as expected. They just went ahead and threw in classes if you want them, since there are already many javascript libraries that provide them for people who either are used to / want classes or to make it easier to port existing code.

coffescript !== javascript, and it never will === javascript.

Re: CoffeeScript: The beautiful way to write JavaScript

#59
post #53
post #25

Earlier quoted context omitted.

Because of whitespace and line break sensitivity you can't dynamically generate serialized CoffeeScript (unless delicately handled) because it won't compile.

Why would you even do that? You could just dynamically generate serialized JS and load it with CoffeeScript.

http://en.wikipedia.org/wiki/Reflection_%28computer_science%...

Re: CoffeeScript: The beautiful way to write JavaScript

#60
post #58

Earlier quoted context omitted.

CoffeeScript is javascript so prototypal objects still work as expected. They just went ahead and threw in classes if you want them, since there are already many javascript libraries that provide them for people who either are used to / want classes or to make it easier to port existing code.

coffescript !== javascript, and it never will === javascript.

Please elaborate. It's easy to match generated Javascript to it's corresponding CoffeeScript source. There's a lot of syntactical sugar, but there isn't much that isn't just a handy shortcut. I used something kinda like CS's class system in JS before I even discovered CS.
Post reply on HN