Live data from Hacker News

"Hello World" in Dart, compiled to JavaScript

gist.github.com

161–162 of 162 posts

Re: "Hello World" in Dart, compiled to JavaScript

#161
post #155

Earlier quoted context omitted.

that's a really interesting comment. where exactly is the line drawn between "just syntactic sugar" and "a different language"? Here we have two ways of expressing code, coffeescript and dart. Both are syntactically quite different from js, both offer features not found in js, both encourage you to write code differently to how you would in js and both compile to plain js.

> where exactly is the line Not that I have an aswer to that, but I have the impression Coffeescript was designed specifically to compile 1:1 to matching js. A lot of the distinction seems to depend on the local culture of the language. I've seen a lot of lispers talking about their new "language", where they add some minor feature to scheme.

...Coffeescript was designed specifically to compile 1:1 to matching js

possibly initially, but there's a lot of constructs in coffeescript that aren't in js eg existential operator

    solipsism = true if mind? and not world?
compiles to

    var solipsism;
    if ((typeof mind !== "undefined" && mind !== null) && !(typeof world !== "undefined" && world !== null)) {
      solipsism = true;
    }
see also splats http://jashkenas.github.com/coffee-script/#splats, function binding and comprehensions over collections eg

    eat food for food in ['toast', 'cheese', 'wine']
Post reply on HN