News for hackers. Stuff that matters.
Re:CoffeeScript: JavaScript without the Fail (slides) by shazow on Saturday September 10, 2011 @01:57AM (#2980961)
Perhaps I'm crazy but I honestly feel mandatory parenthesis here improve readability

    {createServer} = require 'http'
    {createServer} = require('http')

    console.log "Server running at http://#{host}:#{port}/"
    console.log("Server running at http://#{host}:#{port}/")
At the very least, it improves consistency which to me improves readability. Making something "look like language" (or perhaps "prose" is more appropriate) doesn't improve the parsing process for my brain. In fact, the inconsistency with the rest of the non-language "code" throws it off the tracks.

Even if it didn't, I'd still say the ambiguity is not worth it. Perhaps CoffeeScript needs a "use strict"; for the final stroke of irony.

One more question: Why "#{foo}"?

Is there any template language that uses this syntax? (I am not familiar with one.) If it were up to me, I would have chosen "${foo}" to be like Mako, or plain "{foo}" to be like Python's string formatter, or "{{foo}}" to be like the more recently popular Mustache.

Edit: As cschep points out, the "#{foo}" syntax is Ruby string formatting syntax. Thanks.

Re:CoffeeScript: JavaScript without the Fail (slides) by cschep on Saturday September 10, 2011 @02:19AM (#2980995)
Ruby does string formatting that way.
Re:CoffeeScript: JavaScript without the Fail (slides) by andypants on Saturday September 10, 2011 @06:54AM (#2981336)
Jade is a templating lib for javascript, and it uses #{var} and !{var}.

(Although I don't know what that would be doing in a console log.)