jashkenas/coffee-script — pull request #3096 by marchaefner (2013-07-30 17:46:18+00:00)
Title: Disallow single-line `IF expr ELSE` without `THEN`

Fix for #2994 and some minor cleanup.

### Discussion / Motivation

This is done primarily to avoid confusion for people coming from a Python background.

Why not implement a Python-like `else` clause? This would not be very useful in CoffeeScript because we don't have (enough) statements. The quintessential use case for this feature:
```python
x = default_value if is_normal else special_value
```
would not work in CoffeeScript because the above line would be equivalent to:
```coffee
(x = default_value) if is_normal else special_value
```

### Implementation Note

This fix is slightly ugly, since now even more functionality from `removeMidExpressionNewlines` is handled by `addImplicitIndentation`. (It already started with the `TERMINATOR THEN` case.)

It is possible (and easy) to merge the two functions ([here](https://github.com/marchaefner/coffee-script/blob/fdd5796f5ebfbe67817558d26f4b7a7d83d8ab4b/src/rewriter.coffee#L376-L378)).