jashkenas/coffee-script — Issue #1812: Syntax for functions without implicit returns?
Author: reissbaker
Created: 2011-10-29 08:26:32+00:00
State: open

This may be a stretch, but it'd be pretty nice in some cases to have function syntax that makes it easier to not return anything. In several libraries (Vows is one that immediately comes to mind, but implicit returns can trip up jQuery code, too), returning from a function means something different than not returning from a function, and having to write the empty return statements everywhere is awkward and can lead to bugs that aren't immediately obvious.

Something like this would make me really happy:
```(arg) -/> fn() // does not return anything```
```(arg) -> fn() // returns the result of fn()```

What I like about the `-/>` syntax is that it could work both for the current unbound syntax and for the bound version, and it does exactly what it looks like -- it cuts off and suppresses the returned value.