News for hackers. Stuff that matters.
Re:Module Pattern in JavaScript and CoffeeScript by natefaubion on Friday May 31, 2013 @10:40AM (#5798873)
A cleaner way of doing the immediately-invoking function in CS is to use a `do` statement.

    MyModule = do ->
      # module body
No need for any parens.
Re:Module Pattern in JavaScript and CoffeeScript by joshuacc on Friday May 31, 2013 @10:55AM (#5798950)
And you don't even need to use assignment. This works as well:

    do ->
      # module body
Re:Module Pattern in JavaScript and CoffeeScript by catshirt on Friday May 31, 2013 @12:12PM (#5799451)
you don't need to assign it to something, unless you need to assign it to something.

sounds like op was specifically referencing to parens for execution.

Re:Module Pattern in JavaScript and CoffeeScript by dmix on Friday May 31, 2013 @12:18PM (#5799491)
Interesting, I looked this up.

> CoffeeScript provides the do keyword, which immediately invokes a passed function, forwarding any arguments.

Apparently in April 2012 they updated the code to make it simulate namespacing.

> A tweak to the semantics of do, which can now be used to more easily simulate a namespace: do (x = 1, y = 2) -> ...