News for hackers. Stuff that matters.
Re:CoffeeScript: The beautiful way to write JavaScript by skymt on Tuesday March 08, 2011 @02:48PM (#2302322)
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.
Re:CoffeeScript: The beautiful way to write JavaScript by davepeck on Tuesday March 08, 2011 @02:59PM (#2302362)
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.)

Re:CoffeeScript: The beautiful way to write JavaScript by M1573RMU74710N on Tuesday March 08, 2011 @05:21PM (#2302826)
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 formulate your own constructs via it's syntax and semantics.

When the language's syntax and semantics are clunky, verbose, and full of line noise....those things become intermingled with your ideas and your semantics and it becomes difficult to separate the two.

I've been writing Javascript a long time, and what I like about CS is not only that it makes writing code easier by providing shortcuts for patterns I use constantly, but that the finished code more closely resembles the actual ideas I had when I wrote the code. With syntax and semantics that get out of the way you can focus more closely on your ideas and how to improve or fix them imho.

Re:CoffeeScript: The beautiful way to write JavaScript by davepeck on Tuesday March 08, 2011 @05:52PM (#2302937)
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 "pretty" in CoffeeScript outweighs the potential disadvantages -- which is great!

I do like the notion that CoffeeScript syntax gets out of the way; that it lays constructs and ideas bare in a way that JavaScript does not.

Re:CoffeeScript: The beautiful way to write JavaScript by detst on Tuesday March 08, 2011 @06:22PM (#2303028)
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 by neimado on Tuesday March 08, 2011 @07:40PM (#2303262)
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 by alextgordon on Tuesday March 08, 2011 @06:16PM (#2303008)
This is all anecdotal, but learning CoffeeScript took me no more than a few hours, and I seem to be able to write CoffeeScript faster and with less errors than JavaScript. Obviously YMMV, but it's not just about "pretty".
Re:CoffeeScript: The beautiful way to write JavaScript by M1573RMU74710N on Tuesday March 08, 2011 @09:50PM (#2303584)
That's a fair point, and there are a few things I would point out in no particular order:

The first is that CoffeeScript is ultimately a sort of dialect of Javascript. CS and JS can interact with eachother seamlessly, so as mentioned in the OP article there's no need to switch over to CS for everything and/or all at once.

Another important thing is that where possible CS tries to map relatively directly to JS, so for experienced JS developers they will recognize CS as a series of shortcuts which map to idioms they use constantly.

If you are familiar with JS, doing a few small projects in CS should get you pretty familiar with it.

CS is obviously somewhat immature, but I think it's reached the point where it can be considered for "serious work". I've found the tooling is pretty decent: coffee is slick with commands like --watch to recompile on changes, and coffee-mode for emacs is nice. There's also CS mode for vim, textmate, gedit, + more.

Honestly the main hurdle is potential debugging problems, but I haven't found that to be too difficult either. Being mindful of how CS transforms your code, and strategic debugging code make the process for me not much different from debugging regular JS.

So I'd say at this point I don't think CS presents hurdles which are terribly difficult to overcome.

Re:CoffeeScript: The beautiful way to write JavaScript by gmac on Tuesday March 08, 2011 @04:43PM (#2302703)
> 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 by hermanthegerman on Tuesday March 08, 2011 @05:14PM (#2302809)
Hm, to me the value proposition is this:

There are many, many interesting projects that I want to look at, read, potentially use or learn from.

Every little help for reading and understanding many open source projects faster is a huge value and a huge timesaver for me.

I think that clean syntax is just the better tool, like other people would probably prefer an IDE with integrated toolchain and dozens of tools that are modeled after the state of a programming system at some point in time.

Readable semantics behind a clean syntax are the more flexible toolchain in my eyes. It's like an integrated user interface. I can easily read and understand CS/Haml/Sass/Ruby/.. in my own files, in some libraries that i installed, in posts on blogs and on github ..

Re:CoffeeScript: The beautiful way to write JavaScript by jacobolus on Tuesday March 08, 2011 @03:24PM (#2302450)
> Is pretty syntax better than common-use syntax?

What do you mean?

Re:CoffeeScript: The beautiful way to write JavaScript by davepeck on Tuesday March 08, 2011 @03:44PM (#2302524)
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 by gfodor on Tuesday March 08, 2011 @05:30PM (#2302862)
For competent Javascript developers the learning curve to CoffeeScript is an afternoon tops, because it is Javascript. If you consider that, it essentially becomes a free lunch since now you can express your ideas more clearly than raw JS.
Re:CoffeeScript: The beautiful way to write JavaScript by davepeck on Tuesday March 08, 2011 @05:48PM (#2302922)
Interesting. To me, CoffeeScript is emphatically not JavaScript. There are new tools and, well, there's a new syntax. Semantically they may be (almost) equivalent -- but it strikes me as a far stretch to say they're the same, or that developers will treat them the same. I suppose I would feel similarly about HAML, too.
Re:CoffeeScript: The beautiful way to write JavaScript by gfodor on Tuesday March 08, 2011 @11:15PM (#2303761)
CoffeeScript syntax is close enough to Python or Ruby syntax that the syntax itself is "instantly readable" and "quickly writable" -- HAML on the other hand is altogether new syntax and much more 'innovative' on that front than I'd argue Coffee is.

I'd be really shocked if you showed a solid Javascript programmer who has written code in a scripting language like Perl, Python, or Ruby a chunk of CoffeeScript code and he/she couldn't easily infer what was going on just by intuition alone.

Re:CoffeeScript: The beautiful way to write JavaScript by ramidarigaz on Tuesday March 08, 2011 @04:57PM (#2302745)
You say "pretty" like it's a bad thing...
Re:CoffeeScript: The beautiful way to write JavaScript by innes on Wednesday March 09, 2011 @03:58AM (#2304348)
It's unusual usage as well. Like referring to a keyboard that lets me type faster or a screen that's more readable as 'pretty'.