Function identity of non-configurable accessors

David Bruant bruant.d at
Sat Dec 15 14:51:18 PST 2012

Le 15/12/2012 16:14, David Bruant a écrit :
> Le 15/12/2012 15:49, Sam Tobin-Hochstadt a écrit :
>> If I create a non-configurable property with a getter that I define 
>> (such
>> as `() => 3`), I know that accessing the property will always produce
>> a known value.    Relaxing this restriction means that proxies could
>> produce whatever they wanted in this situation.
> Indeed. Note that it's true currently true with ES5 host objects.
I'd like to add that you can defend yourself by checking if the 
reflected function is the one you put in there.
As far as expecting some behavior on [[Get]] or [[Set]], nothing 
prevents a proxy from either not calling the getter/setter you passed or 
do call them but do/return whatever inconsistent with the accessor. Or 
why not call the setter on [[Get]] and the getter on [[Set]].
That might be one reason why there was no invariant regarding accessors 
in ES5.


More information about the es-discuss mailing list