Live data from Hacker News

CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

jashkenas.github.com

11–20 of 67 posts

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#11
Splendid! This is what JS really needs, a thin layer to clean up the syntax and patch the quirks, without breaking anything. I made the same kind of thing using the actual Ruby parser:

http://github.com/jedediah/prettyscript

It's only barely usable at this point and I've been too busy to work on it.

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#12

JavaScript has always had a gorgeous object model hidden within Java-esque syntax. CoffeeScript is an attempt to expose the good parts of JavaScript through syntax that favors expressions over statements, cuts down on punctuation noise, and provides pretty function literals. This CoffeeScript: square: x => x * x. Compiles into this JavaScript: var square = function(x) { return x * x; }; If anyone has specific ideas a…

Looks great, I'll need time to dig in but Thank You in advance

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#13

Splendid! This is what JS really needs, a thin layer to clean up the syntax and patch the quirks, without breaking anything. I made the same kind of thing using the actual Ruby parser: http://github.com/jedediah/prettyscript It's only barely usable at this point and I've been too busy to work on it.

Great stuff. The one really interesting overlap between the two -- from taking a quick glance at your readme, is that we're both trying to convert things that otherwise would be statements in JavaScript into expressions.

CoffeeScript does this by using the AST to recursively push down returns and assignments requested from outside a block to the final line of each possible branch of execution:

http://jashkenas.github.com/coffee-script/#expressions

How are you doing it? Did you find any particularly tricky cases?

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#16
post #14

Heh... Might want to choose a file extension other than ".cs".

Yeah, all the good extensions are taken -- .cof and .cfs are already other things as well. None of the tooling in the compiler cares about what extension you use: you can call it .coffeescript if you'd like. I'm going to stick to .cs for the parallel to .js for the time being.

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#17
post #14

Heh... Might want to choose a file extension other than ".cs".

Yeah, all the good extensions are taken -- .cof and .cfs are already other things as well. None of the tooling in the compiler cares about what extension you use: you can call it .coffeescript if you'd like. I'm going to stick to .cs for the parallel to .js for the time being.

Well, it seems that .cof and .cfs aren't associated with other programming languages, so the overlap there is less problematic.

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#19
post #7

Beautiful! (I finally made it to the end of the article where you ask about block delimiting...) I think there are two issues, one being that '........' at the end of a large nested expression is ugly, the other being that it's hard to find the start and end of a block as it stands. Since you seem to borrow a lot from ruby, why not add {} and/or begin/end as options? I would definitely keep the period syntax around (…

Yeah, the periods to end block scope are the part of the syntax I'm the least happy with. I couldn't think of anything nicer without resorting to significant whitespace (which I'd like to avoid). I'd rather not add {/}, or begin/end, because it's easy to determine the beginning of the block, it's just closing it that we need a symbol for. In terms of style, you can certainly indent the period on it's own line if you…

Out of curiosity, what makes you want to avoid significant whitespace? I think it solves the issue quite nicely. For what it's worth, I used to think SW was completely absurd. Then I spent a few years actually writing Python and have no desire to ever go back.

Re: CoffeeScript, a little language that compiles to JavaScript. Happy Holidays, HN

#20

JavaScript has always had a gorgeous object model hidden within Java-esque syntax. CoffeeScript is an attempt to expose the good parts of JavaScript through syntax that favors expressions over statements, cuts down on punctuation noise, and provides pretty function literals. This CoffeeScript: square: x => x * x. Compiles into this JavaScript: var square = function(x) { return x * x; }; If anyone has specific ideas a…

Alright, this is bugging me. Why are you using colons for assignment?
Post reply on HN