WebIDL attribute reflection

Boris Zbarsky bzbarsky at mozilla.com
Mon Dec 31 10:46:18 PST 2012


On 12/31/12 2:24 AM, David Bruant wrote:
> Polyfillability is an interesting criteria. Is
> Object.getOwnPropertyDescriptor polyfillability important? Would a good
> [[Get]]+[[Set]] polyfill be enough? By that I mean that as long as the
> [[Get]]+[[Set]] behavior is good, maybe polyfilling a property by an
> accessor is good enough?

Getting the right [[Get]] and [[Set]] behavior is enough, but how do you 
propose to implement a polyfill that calls the "original" getter or 
setter in some cases if those getters and setters aren't ever exposed 
anywhere?

> I tend to consider data or accessor property as an implementation
> detail.

Not sure what you mean.  How is it any more or less an implementation 
detail than property vs method, say?

> It's important to specify it in WebIDL for interoperability, but
> authors should be worried of making the [[Get]]/[[Set]] protocol work

Yes, agreed.

> If necessary, WebIDL is free to add custom property descriptor
> attribute.

Uh...  No.  I don't think it is.  Nothing else in the language or othe 
standards would know anything about this attribute; various other 
specifications that work in terms of property descriptors would suddenly 
start doing weird stuff, no?

> And it would create an own property of type long (so subject to all
> relevant WebIDL logic).

That requires putting the WebIDL logic in the ECMAScript implementation, 
no?  Which is not how it works in at least SpiderMonkey and V8 (which 
are meant as standalone ECMAScript implementations).

-Boris


More information about the es-discuss mailing list