The definesetter and definegetter reminds of how we used look into MSIL code using disassembler tool. On Similar line in javascript the line interpreter does this.
if (Object.prototype.__defineGetter__)
return obj.__defineGetter__(prop, get);
if (Object.prototype.__defineSetter__)
return obj.__defineSetter__(prop, set);
Courtesy By
http://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/
As you may have noticed, all examples here use
In a distant future we would like to remove support for
if (Object.prototype.__defineGetter__)
return obj.__defineGetter__(prop, get);
if (Object.prototype.__defineSetter__)
return obj.__defineSetter__(prop, set);
Courtesy By
http://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/
As you may have noticed, all examples here use
Object.defineProperty
in preference to either __defineGetter__
or __defineSetter__
, using the latter two only as fallback when the former is absent. While many browsers support these methods, not all do. Object.defineProperty
is the future, and it is the standard; Microsoft has even gone on the record to say that they will not implement __defineGetter__
or __defineSetter__
in IE given the existence of the standardized method (props to them for that choice, by the way). For greatest forward compatibility with all browsers, you should use Object.defineProperty
if it exists, and only fall back to __define{G,S}etter__
if it does not.In a distant future we would like to remove support for
__defineGetter__
and __defineSetter__
, after ES5 adoption has taken off, so as not to distract from the standardized support. The less new web developers have to know about legacy extensions superseded by standardized alternatives, the better. This action is at least several years in the future, likely longer; being able to make the change will require preparation and adjustment in anticipation of that time.
1 comment :
Excellent blog post. I certainly appreciate this website. Stick with it!
Business analysis online training
Business analysis training
Cognos online training
Cognos training
Core Java online training
Core Java training
Django online training
Django training
Go Language online training
Go Language training
Post a Comment