Comment #3 on issue 3394 by [email protected]: API should allow symbols as property names
http://code.google.com/p/v8/issues/detail?id=3394

Cool, thanks for the thoughts.

I reckon adding a Name is still compatible, and changing functions that take Local<String> to take Local<Name> is probably also fine. The incompatibility will come with the accessor/interceptor callbacks.

WDYT about just duplicating those interfaces?  For example now there is:

 typedef void (*AccessorGetterCallback)(
     Local<String> property,
     const PropertyCallbackInfo<Value>& info);
 typedef void (*AccessorSetterCallback)(
     Local<String> property,
     Local<Value> value,
     const PropertyCallbackInfo<void>& info);
 bool Object::SetAccessor(Handle<String> name,
                          AccessorGetterCallback getter,
                          AccessorSetterCallback setter = 0,
                          Handle<Value> data = Handle<Value>(),
                          AccessControl settings = DEFAULT,
                          PropertyAttribute attribute = None);

I would add:

typedef void (*AccessorSymbolGetterCallback)(
    Local<Symbol> property,
    const PropertyCallbackInfo<Value>& info);
typedef void (*AccessorSymbolSetterCallback)(
    Local<Symbol> property,
    Local<Value> value,
    const PropertyCallbackInfo<void>& info);
bool Object::SetAccessor(Handle<Symbol> name,
                         AccessorSymbolGetterCallback getter,
                         AccessorSymbolSetterCallback setter = 0,
                         Handle<Value> data = Handle<Value>(),
                         AccessControl settings = DEFAULT,
                         PropertyAttribute attribute = None);

and store a union { AccessorGetterCallback, AccessorSymbolGetterCallback } etc in the accessor. The advantage of this is that usually what you want is the property name as a String, not a Name. It also doesn't break the API so the anger will be minimal, one would hope. OTOH it's not as well-factored.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to