thomasboyt/defeatureify — pull request #6 by pangratz (2013-11-27 20:00:26+00:00)
Title: Proof of concept: Remove debug statements like `Ember.assert`

This is a proof of concept to use the parsed syntax tree and remove all
debug statements like `Ember.[assert|deprecate|warn|debug]` or
`Ember.Logger.info`.

Currently those statements are required to be a oneliner and they are
removed by a simple string substitution (see http://git.io/i2wnpg).

By using something like this, it would be possible to even write
assertions like this:

```javascript
Ember.assert("this is a complex error", function() {
if (state === "isError" && !stateHandled) { return false; }
if (state === "warning" || state === "info") { return false; }

// return true, to indicate that the assertion was OK
return true;
});
```

---

As stated above, this was just an experiment to see how easy it would to be to make this work. The assert statements in the Ember code can get quite [long](https://github.com/emberjs/ember.js/blob/3070328313b9c442d42b4ffb38790ee4683c2b41/packages/ember-views/lib/system/event_dispatcher.js#L104) and this would be a solution to solve this.

Any thoughts? Something worth putting more brain power into?