News for hackers. Stuff that matters.
Re:Move Lang by jashkenas on Monday March 14, 2011 @10:22AM (#2322563)
For the curious -- I was wondering what the initial example:

    hello = ^(name){ "Hello "+name }
    repeat {times: 3} ^{
      print hello {name: "John"}
    }
... compiled to as JavaScript. Here's the output, which you can reproduce by calling "move.compile()":

      "use strict";
      var Move, _MoveKWArgsT, Text, extend, create, print, repeat, after, JSON,
        hello;
      Move = __move.runtime, _MoveKWArgsT = Move._MoveKWArgsT, Text = Move.Text,
        extend = Move.extend, create = Move.create, print = Move.print, repeat =
        Move.repeat, after = Move.after, JSON = Move.JSON, require = Move.require;
      return hello = function (name) {
        name !== null && typeof name === "object" && name.__kw === _MoveKWArgsT 
          && (arguments.keywords = name, name = name.name);
        return "Hello " + name;
      }(repeat({
        times: 3,
        __kw: _MoveKWArgsT
      })(function () {
        return print(hello({
          name: "John",
          __kw: _MoveKWArgsT
        }));
      }));
For comparison, here's what the same example in CoffeeScript:

    hello = (name) -> "Hello " + name
    for i in [1..3]
      print hello "John"
... compiles to as JavaScript (which you can reproduce in the "Try CoffeeScript" console):

    var hello, i;
    hello = function(name) {
      return "Hello " + name;
    };
    for (i = 1; i <= 3; i++) {
      print(hello("John"));
    }
Re:Move Lang by itsnotvalid on Monday March 14, 2011 @11:19AM (#2322808)
The very first part of it is really the injection of Move specific functions like 'repeat' and 'after'. It's just that they are injected as functions instead of being replaced directly in code.

Then it does the enabling of the ability of calling via hello 'x' or hello {name:'x'}, some syntactic sugar.

As my limited knowledge of coffeescript goes, you advocates on having the generated script as readable as possible, so these kind of sugar may irritate you ;-)

Re:Move Lang by _tef on Monday March 14, 2011 @10:58AM (#2322701)
coffeescript is only a syntactic change and introduces no new semantics.

it will always win in terms of code generated