gkz/LiveScript — pull request #226 by DavidSouther (2012-12-07 15:27:29+00:00)
Title: Observers? In the Syntax?

I have been playing around with an idea to bake the observer pattern directly into the syntax of the language. I find it has streamlined many parts of my development in other projects. I'd be curious about the community's thoughts, and whether this would be something worth adding to LiveScript.

In short, we add new operators:

* `:>` observe
* `<:` trigger

```
# callback will be run whenever source.event is triggered
source.event :> callback
# Will cause callback to be called in source.event scope and passed event-data
source.event <: event-data
```

A full discussion is at http://davidsouther.com/2012/12/observers-in-my-syntax/