standardize watch feature

Mike Samuel mikesamuel at
Sun Dec 27 14:59:23 PST 2009

2009/12/27 memolus at <memolus at>:
> I would have to use *2* names per attribute "x" and "x_". That's
> crazy. I would have to use an library which does make this job for me.

Or one for a backing store and the same name in that backing store.

> I can't write an model with
> Object.defineProperty(
>    model, 'x',
>    { 'set': function (newx) {  model.x_ = x; object1.signal("x");
> object2.signal("x"); object3.signal("x") },
>      'get': function() { return model.x_ }, writable: true })

I don't know what you mean by model, why libraries are insufficient,
or why various alternatives don't work.  I also don't know why works but property accessors don't, and how you work
around problems with multiple watchers clobbering each other.

If you want to post a strawman that describes the problem in detail,
explains non-language-changing alternatives and why they are
insufficient, an idea of how many developers run into this problem,
and details the syntactic changes and their semantics; then I and
others on this list would be happy to take a look. is a good
place to find examples.

> 2009/12/27 Mike Samuel <mikesamuel at>:
>> ES5 Setters let you do this.
>> Object.defineProperty(
>>    model, 'x',
>>    { 'set': function (newx) { model.x_ = x; },
>>      'get': function() { return model.x_ }, writable: true })
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list