News for hackers. Stuff that matters.
Re:JS 2 CoffeeScript Compiler by fooyc on Wednesday September 14, 2011 @01:08PM (#2997003)
> would be nice for 'academic' reasons if the compiler translated js->cs perfectly

You should expect this from a compiler, actually

> In my opinion, js functions should always return a value

Sounds wrong

> real code example of where your program would fail because of this?

Simple:

    // That's perfectly fine; why would I return anything from this ?
    link.onclick = function() {
        doSomething();
    };

    // Now, translated in coffeescript:
    link.onclick = ->
        return doSomething(); // if this returns false, the "click" event is canceled
Re:JS 2 CoffeeScript Compiler by fooyc on Wednesday September 14, 2011 @03:40PM (#2997564)
An other good example is constructors; say you have a function like this:

    function MyClass(x){
        this.x = x;
    }
In Coffeescript this translates to

    MyClass = (x) ->
        @x = x
`x` is returned; and if you return something from a constructor, something is returned instead of the constructed object (`new MyClass({})` returns `{}`).