On Oct 19, 2011, at 12:07 PM, Axel Rauschmayer wrote:

>> 1. Deprecate [] for property access in non-collection objects and use 
>> methods such as Object.getProperty(name) and Object.setProperty(name, 
>> value), instead.
> 
> Additionally:
> 
> Object.prototype.operator[]get = function (name) {
>    return Object.getProperty(name);
> }
> Object.prototype.operator[]set = function (name, value) {
>    return Object.setProperty(name, value);
> }
> 
> 

In principal, that's how it should work.  In practice, since we have to deal 
with objects that don't inherit from Object.prototype I suspect it is best to 
leave the fall back behavior as part of the definition of the operator.

Also you need another argument in both of your reflection functions:

Object.prototype.operator[]get = function (name) {
   return Object.getProperty(this, name) ;
}
Object.prototype.operator[]set = function (name, value) {
   return Object.setProperty(this, name, value);
}

Allen



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to