The V8 WebKit bindings generates something like this:

object->SetAccessor(name, getter, 0 /* setter */, data,
static_cast<v8::AccessControl>(v8::DEFAULT),
static_cast<v8::PropertyAttribute>(v8::ReadOnly)

There are two really strange behaviors with this:

1. The descriptor for this reports this as writable:

var descr = Object.getOwnPropertyDescriptor(object, name);
descr.writable  // true!

2. Setting the property works

object.name = 42;
object.name  // 42

However, if we remove the ReadOnly flag in the call to SetAccessor we
get a writable property that cannot be written to:

object->SetAccessor(name, getter, 0 /* setter */, data,
static_cast<v8::AccessControl>(v8::DEFAULT),
static_cast<v8::PropertyAttribute>(v8::None)

var descr = Object.getOwnPropertyDescriptor(object, name);
descr.writable  // true

object.name = 42;
object.name  // not 42!


This is pretty strange. What I want is a property that is writable but
if not set should call the getter.

One way I can implement this is to generate a setter too that when set
reconfigures the property. Is there a way to remove a V8 accessor?
Would a call to Delete() make this a slow object?


-- 
erik

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to