jashkenas/coffee-script — Issue #1855: Add a function syntax which does not return the value of last expression
Author: gravof
Created: 2011-11-11 10:26:30+00:00
State: open

Can we have something like this:

-|> @print('no return')
=|> @print('no return')

Which will compile into:

var _this = this;

(function() {
this.print('no return');
});

(function() {
_this.print('no return');
});

Having to put a standalone `null` or `undefined` at the bottom of a function if it doesn't need to return anything doesn't look quite good.
I choose "-|>" and "=|>" because the pipe looks like being "blocking" the function from returning, but the actual tokens are not important. They can be anything you like.