[webkit-dev] JS: Getter/Setter callbacks at Property level
ggadwa at charter.net
Fri Jul 24 06:23:27 PDT 2009
2) There's not currently a performance penalty for re-checking the
property name in the catchall getter that you currently have available,
Pretty much changes everything for me. Now it's just code I have to
write instead of a possible spot of un-optimal code when "context"
switching between my code and the script engine. I think a way to
one-off way is still more desirable, but this removes my biggest fear.
Note that "JSClassSetPropertyGetterSetter" was just an example, anyway
it's implemented would be fine with me.
Maciej Stachowiak wrote:
> Jumping in late here, but a couple of points:
> 1) Instead of JSClassSetPropertyGetterSetter, it might be more in line
> with the class design to be able to define getters and setters in the
> class struct, just as functions are. In addition to being more
> convenient, this API may also provide future optimization
> opportunities when we optimize access to programmatically defined
> 2) There's not currently a performance penalty for re-checking the
> property name in the catchall getter that you currently have
> property lookup first.
> 3) Probably the easiest way to restructure your code with the current
> API is to have a single get function that checks against property
> names, and calls the right individual property getting functions. That
> should require less rewriting, while working mostly in the bounds of
> the current API.
> 4) When we add support for ES5 property attributes, it would probably
> make sense to expose this in the API as well, which would make it
> possible to define one-off getters on objects.
> - Maciej
> On Jul 22, 2009, at 10:26 PM, Geoffrey Garen wrote:
>> On Jul 20, 2009, at 3:51 PM, Brian Barnes wrote:
>>> What should be my next step, here? Submit a "bug" for this?
>>> [>] Brian
>>> On Jul 20, 2009, at 6:05 PM, Geoffrey Garen wrote:
>>>>> How about separate call backs at the class level? That would
>>>>> solve my problem with minimal code movement. Something like:
>>>>> Would that be more within the design?
>>>> Yes. That's what I had in mind when I mentioned "an API for adding
>>>> C getters and setters to a class individually."
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org <mailto:webkit-dev at lists.webkit.org>
More information about the webkit-dev