Le 11/10/2011 05:48, Cameron McCormack a écrit :
On 24/09/11 8:35 AM, Allen Wirfs-Brock wrote:
Regarding, WebIDL. It seems to me, that it just needs an extended
attribute to specifies which attributes are instance attributes
rather than prototype attributes.
I think it only makes sense to have IDL attributes correspond to
properties on the instance itself if the property can be a data
property, and that if it can be modelled with a data property then it
needs to have no special behaviour when being assigned to (no type
coercions due to IDL, no other behaviour)
Oh true! Current WebIDL 4.5.5 Attribute, for the setter, step 6 "Let
idlValue be the result of converting V to an IDL value.". So, DOM
attributes are typed and the typing is enforced by their ECMAScript
representation.
unless we want to require JS implementations to use proxies for these
objects.
Indeed. I hadn't noticed the type enforcement. I take back all what I
said about DOM attributes being data property. A setter with type
enforcement sounds like a better idea than proxies returning data
descriptor.
It gives me an idea for a proxy library which would be to pass a custom
field in a data descriptor indicating the type. The proxy would enforce
the type under the hood and either coerce silently or throw if the type
is incorrect.
David
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss