jashkenas/coffee-script — pull request #2370 by paulmillr (2012-06-06 05:23:22+00:00)
Title: Allow dashes in identifiers, mangle them.

This patch enables using dashes in identifier names and mangles letters after them to uppercase.
E.g. `for-each` would be compiled to `forEach`.

This easily allows interoperation with javascript and greatly improves interopaability with it, because you're able to write code in idiomatic js style and everyone would be able to use it without bullshit.

Closes #2345.

Big fat example:

```coffeescript
user = document.query-selector('.user')
user.add-event-listener 'click', ((event) -> console.log event), yes

id = window.set-interval ->
console.log 'hello'
, 1000
window.set-timeout (-> window.clear-timeout id), 1500

encoded = encode-URI-component string
number = parse-int '5'
string = number.to-string()

page-text = document.query-selector('body').inner-text
loggedIn = $('body').has-class 'logged-in'
obj = {a: 1, b: 2}
descriptors = Object.get-own-property-names(obj)
.map((name) -> Object.get-property-descriptor obj, name)
```

compiles to

```javascript
var descriptors, encoded, id, loggedIn, number, obj, pageText, string, user;

user = document.querySelector('.user');

user.addEventListener('click', (function(event) {
return console.log(event);
}), true);

id = window.setInterval(function() {
return console.log('hello');
}, 1000);

window.setTimeout((function() {
return window.clearTimeout(id);
}), 1500);

encoded = encodeURIComponent(string);
number = parseInt('5');
string = number.toString();

pageText = document.querySelector('body').innerText;

loggedIn = $('body').hasClass('logged-in');

obj = {
a: 1,
b: 2
};

descriptors = Object.getOwnPropertyNames(obj).map(function(name) {
return Object.getPropertyDescriptor(obj, name);
});
```