On 2013/08/20 17:05:40, Michael Starzinger wrote:
[...]
- SetDataProperty(), for normal data properties taking HValue
- SetNativeProperty(), for data properties using
Accessor[G/S]etterCallback
- SetAccessorProperty(), for JavaScript accessors
I would prefer having "Data" somehow in the 2nd version, e.g.
"SetNativeDataProperty" or perhaps just overloading things via
"SetDataProperty". From the signature is blindingly obvious that it is using
some kind of callback mechanism, but it is highly unclear that this results
in a
*data* property.
To be more precise, this would yield the following signatures:
void SetDataProperty(Handle<String> name,
Handle<Data> value,
PropertyAttribute attributes = None);
void SetNativeProperty(Handle<String> name,
AccessorGetterCallback getter,
AccessorSetterCallback setter = 0,
Handle<Value> data = Handle<Value>(),
AccessControl settings = DEFAULT,
PropertyAttribute attribute = None,
Handle<AccessorSignature> signature =
Handle<AccessorSignature>());
void SetAccessorProperty(Handle<String> name,
Handle<FunctionTemplate> getter,
Handle<FunctionTemplate> setter =
Handle<FunctionTemplate>(),
AccessControl settings = DEFAULT,
PropertyAttribute attribute = None);
Looking at this, we could refactor this into a single
function "DefineProperty",
getting a name and a property descriptor, mirroring what JavaScript does
(with
the additional variation of a getter/setter pair exposed as a data
property).
Partly joking, partly dreaming of a good API... :-]
https://codereview.chromium.org/23182003/
--
--
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/groups/opt_out.