Live data from Hacker News

CoffeeScript hits 1.0 -- Happy Holidays, HN

jashkenas.github.com

31–40 of 55 posts

Re: CoffeeScript hits 1.0 -- Happy Holidays, HN

#31

The war on curlies is over, curlies lost. Good to see new languages improving upon syntax, readability is key and a great way to gain adoption. As Norvig said, it is easier for him to explain an algorithm in python than any other language. Well, now CoffeeScript has just passed that test too. Brendan Eich is also adapting many good things from CoffeeScript to JS.next, validating the point that coffee, in its short li…

The page says, "Objects may be created using indentation instead of explicit braces, similar to YAML. "

Similar to YAML? What exactly does that mean? Is there someplace that explains the specific indentation rules?

The indentation rules of YAML are massively borked; it's not enough that something be indented, it has to be indented a very specific number of spaces. As opposed to, say, Haskell's more sane off-side rules.

Re: CoffeeScript hits 1.0 -- Happy Holidays, HN

#32

The war on curlies is over, curlies lost. Good to see new languages improving upon syntax, readability is key and a great way to gain adoption. As Norvig said, it is easier for him to explain an algorithm in python than any other language. Well, now CoffeeScript has just passed that test too. Brendan Eich is also adapting many good things from CoffeeScript to JS.next, validating the point that coffee, in its short li…

The page says, "Objects may be created using indentation instead of explicit braces, similar to YAML. " Similar to YAML? What exactly does that mean? Is there someplace that explains the specific indentation rules? The indentation rules of YAML are massively borked; it's not enough that something be indented, it has to be indented a very specific number of spaces. As opposed to, say, Haskell's more sane off-side rule…

CoffeeScript isn't particular about the specific number of spaces, as long as you're consistent. For example:

    book.save
      title: "The Book of the Thousand Nights and One Night"
      length: 45
      chapters: 
        "The Fisherman and the Jinni":       1
        "The Tale Of The Ensorceled Prince": 13
        "The First Kalandar's Tale":         27

Compiles into this JavaScript:

    book.save({
      title: "The Book of the Thousand Nights and One Night",
      length: 45,
      chapters: {
        "The Fisherman and the Jinni": 1,
        "The Tale Of The Ensorceled Prince": 13,
        "The First Kalandar's Tale": 27
      }
    });

Re: CoffeeScript hits 1.0 -- Happy Holidays, HN

#35

The war on curlies is over, curlies lost. Good to see new languages improving upon syntax, readability is key and a great way to gain adoption. As Norvig said, it is easier for him to explain an algorithm in python than any other language. Well, now CoffeeScript has just passed that test too. Brendan Eich is also adapting many good things from CoffeeScript to JS.next, validating the point that coffee, in its short li…

The page says, "Objects may be created using indentation instead of explicit braces, similar to YAML. " Similar to YAML? What exactly does that mean? Is there someplace that explains the specific indentation rules? The indentation rules of YAML are massively borked; it's not enough that something be indented, it has to be indented a very specific number of spaces. As opposed to, say, Haskell's more sane off-side rule…

I'm afraid that's not correct. You can use arbitrary number of spaces to indent a block in YAML[1]. It does't matter if it's 2 of 4 or 17.

The only limitations are that it must be greater than the indentation of the parent node (obviously), that all siblings must have the same indentation and that tabs are not allowed.

Are you sure you're not mistaking this with HAML? It's a bit stricter with the indentation requirements.

[1]: http://www.yaml.org/spec/1.2/spec.html#id2777534

Re: CoffeeScript hits 1.0 -- Happy Holidays, HN

#37

Things have come a long way in the past year, since this conversation: http://news.ycombinator.com/item?id=1014080 Some of the interesting recent features include executable class bodies, extended regular expressions, functions with default arguments, and YAML-style object literals. Thanks for all the great suggestions and patches (almost a thousand Github issues, with many thousands of comments). The language has be…

Thank you, thank you, thank you !

Re: CoffeeScript hits 1.0 -- Happy Holidays, HN

#38

Would people be interested in a Ruby-oriented project like this? Say, tiny.rb ported to use Javascript? (Some Googler already has a Lua-esque VM for tiny.rb as her 20% project.)

There are a number of existing projects that compile a partial Ruby into JS: * https://github.com/superchris/rubyjs * https://github.com/jessesielaff/red * https://github.com/tlrobinson/cappruby I'm afraid that Ruby semantics don't align too well with JavaScript semantics. Things as basic as numbers, method dispatch, and variable scoping don't work the same way. Either you end up with perfectly valid code written in…

Perfectly valid code that runs in one and not the other is fine, so long as context switching can be minimized between browser and server. (It's still a switch, but smaller.)

Re: CoffeeScript hits 1.0 -- Happy Holidays, HN

#39

Newbie question: How is CoffeeScript typically used? On a web server running node.js? In the browser after including CoffeeScript the way you might include jQuery? Either? Some other way?

Anywhere you might use JavaScript. For building web sites, working with canvas, doing servers with Node.js, or scripting the JVM with Rhino ... for example:

A Riak client: http://riakjs.org/

A canvas sketch: http://jashkenas.s3.amazonaws.com/misc/buddhabrot/buddhabrot...

A string scanning library: http://sstephenson.github.com/strscan-js/

An in-browser tank game: https://github.com/stephank/orona

A Node.js-powered Rack server: http://josh.github.com/nack/

Post reply on HN