Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-25 Thread Maciej Stachowiak
On Jul 24, 2009, at 7:23 AM, Brian Barnes wrote: This: 2) There's not currently a performance penalty for re-checking the property name in the catchall getter that you currently have available, because it gets called without JavaScriptCore doing a property lookup first. Pretty much

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-24 Thread Brian Barnes
This: 2) There's not currently a performance penalty for re-checking the property name in the catchall getter that you currently have available, because it gets called without JavaScriptCore doing a property lookup first. Pretty much changes everything for me. Now it's just code I have to

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-22 Thread Geoffrey Garen
Sure! Geoff 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.

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-22 Thread Maciej Stachowiak
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

[webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Brian Barnes
I was getting ready to try the first move from SpiderMonkey to Nitro, and ran into a large problem. Right now, all my getters and setters are at the property level. In the documentation I have, Nitro only seems to put them at the object level. This would force a huge refactoring of my code

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Geoffrey Garen
Hi Brian. I don't understand the distinction you're drawing between the property level and the object level. Can you explain what those mean and give an example of each? Thanks, Geoff On Jul 20, 2009, at 9:14 AM, Brian Barnes wrote: I was getting ready to try the first move from

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Brian Barnes
In SpiderMonkey, you can create an object, and that object has a callback to a getter or a setter in C. You get the name, look it up, return or set a value. Nitro has that same functionality. On SpiderMonkey, though, when creating a property, you can also do this:

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Geoffrey Garen
Hi Brian. I see what you mean now. In JavaScriptCore, there's no API for defining C getters and setters individually. There's an API for associating a set of C getters and setters with a class, and there's an API for defining a generic fallback getter and setter for a class. I looked

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Brian Barnes
I'm not sure you get exactly what I'm saying as you put class in places where I'd expect property. For instance: I looked briefly, and it seems like it would be relatively easy to add an API for adding C getters and setters to a class individually. So, that seems like a reasonable feature

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Oliver Hunt
On Jul 20, 2009, at 11:48 AM, Brian Barnes wrote: I'm not sure you get exactly what I'm saying as you put class in places where I'd expect property. For instance: I looked briefly, and it seems like it would be relatively easy to add an API for adding C getters and setters to a class

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Geoffrey Garen
I'm not sure you get exactly what I'm saying as you put class in places where I'd expect property. For instance: I looked briefly, and it seems like it would be relatively easy to add an API for adding C getters and setters to a class individually. So, that seems like a reasonable

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Brian Barnes
How about separate call backs at the class level? That would solve my problem with minimal code movement. Something like: JSClassSetPropertyGetterSetter(ctx,class,red,myRedGetter,myRedSetter); Would that be more within the design? BTW, thanks for listening and leading me through some

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Geoffrey Garen
How about separate call backs at the class level? That would solve my problem with minimal code movement. Something like: JSClassSetPropertyGetterSetter (ctx,class,red,myRedGetter,myRedSetter); Would that be more within the design? Yes. That's what I had in mind when I mentioned an API

Re: [webkit-dev] JS: Getter/Setter callbacks at Property level

2009-07-20 Thread Brian Barnes
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: JSClassSetPropertyGetterSetter