News for hackers. Stuff that matters.
Re:CoffeeScript -- You Are Totally Gonna Hate It by jashkenas on Saturday July 17, 2010 @04:25PM (#1524571)
It doesn't have a translator from JS to Coffee, I'm afraid. There isn't a one-to-one mapping (ie. detecting when you're actually using a for loop as an array comprehension).

As for watching a directory for changes, absolutely. Just pass "--watch" to the "coffee" executable. For example:

    coffee --compile --watch --output lib src/
    
    coffee -cw -o lib src/
Which will watch "src" for changes, and compile all ".coffee" files inside to ".js" files in "lib", preserving the directory structure.
Re:CoffeeScript -- You Are Totally Gonna Hate It by dreyfiz on Sunday July 18, 2010 @05:19AM (#1525473)
I've been working with coffeescript all evening and I'm loving it. My one suggestion/complaint so far is that you should follow Python more closely in refusing to accept an assignment in conditionals and insisting on comparisons only, because it eliminates a lot of bugs. E.g. if I type

  if x = y
The compiler should raise a syntax error.
Re:CoffeeScript -- You Are Totally Gonna Hate It by jashkenas on Sunday July 18, 2010 @07:59AM (#1525621)
Glad you mentioned that point. The distinction between '=' and '==' in most programming languages is a personal pet peeve of mine. I think that it confuses two separate issues: labeling a value with a name, and testing the equality of values. Terrifically confusing stuff if you're coming from algebra.

So, although '=' is available to make transitioning from other languages smoother, idiomatic CoffeeScript would use ':' for assignment, both within and outside of object literals, and would use 'is' for equality. Harder to make a bug out of:

    if x is y
Re:CoffeeScript -- You Are Totally Gonna Hate It by dreyfiz on Sunday July 18, 2010 @04:49PM (#1526690)
Thanks, I'd somehow missed "is" and "isnt" in the docs!
Re:CoffeeScript -- You Are Totally Gonna Hate It by dreyfiz on Saturday July 17, 2010 @04:31PM (#1524583)
Excellent! I didn't think reverse translation would an easy problem for javascript, so I wasn't really expecting it.