Controlling DontEnum (was: ES4 draft: Object)

Kris Zyp kris at sitepen.com
Thu Mar 13 12:33:11 PDT 2008


> set dontDelete and readOnly? You can create non-deletable properties
> by using a class or record type
They can't be added after an object is created.

> and you can create read-only
> properties by adding a get function without a corresponding set...
Unless behavior is different than ES3, setters (and lack thereof) are not 
dontDelete, therefore still easily mutated:
>>> obj = {get foo() { return 'hi' }}
Object foo=hi
>>> obj.foo
"hi"
>>> delete obj.foo
true
>>> obj.foo = 'goodbye'
"goodbye"
>>> obj.foo
"goodbye"




More information about the Es4-discuss mailing list