6 ms·
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.
by natefaubion 13y ago
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.
- joshuacc 13y agoAnd you don't even need to use assignment. This works as well: do -> # module body
- deleted 13y ago[deleted]
- catshirt 13y agoyou 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.
- dmix 13y agoInteresting, 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) -> ...