lookup attributes/getters/setters (was Re: ES4 draft LAST CALL: Object)

# Kris Zyp (17 years ago)

Do we have any mechanism for detecting if a property is using a getter/setter or detecting the attributes of a property? It seems like if we can get make getters/setters as properties through object initializers, we should be able to detect if a property is using a getter/setter. Also, if we can define property attributes through Object.defineProperty, it seems we should also be able to detect the attributes of a property. As far as attributes, I believe you can use various (ugly) tests to see a property is readonly, permanent, and/or enumerable, but it seems reasonable to have a complement to defineProperty that could provide this information. In SM (and Safari and newer Opera, I assume), you can determine if a property has a getter/setter (and get the function) with lookup{G|S}etter.

Thanks, Kris

----- Original Message ---

# Lars Hansen (17 years ago)

IMO the reflection API needs to be able to reveal these things. So keep an eye out when that spec is released.

# Adam Barth (17 years ago)

We tried to use the reflection API in Firefox and WebKit to determine if a property had a getter or a setter, but we ended up needing to know if the reflection API itself had a getter or a setter defined. Just something to think about when designing the API.