W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

[bindings] Regarding the algorithm of 4.2.2. Interface prototype object

From: liorean <liorean@gmail.com>
Date: Fri, 11 Apr 2008 06:41:00 +0200
Message-ID: <cee13aa30804102141n3c48a5c2mfddebe284d636cdb@mail.gmail.com>
To: "Web APIs WG (public)" <public-webapi@w3.org>


I think this algorithm as written is severely broken. The reason is
that [[HasProperty]] will travel the entire chain for each of the
interfaces in order. As such, if a member was to be present on both
Object.prototype and B.prototype in the example IDL, because
A.[[Prototype]] is Object.prototype, the member on Object.prototype
will trump the member on B.prototype. This means that if a script adds
a property to Object.prototype (discouraged practice, but still...)
which has a name that coincides with a property defined in the IDL of
B, any code using an object of type C will get the value from
Object.prototype instead of from B.prototype.

I propose a change to instead use the C3 algorithm as used in Dylan,
Python 2.3, Perl 6:

This ensures that a member of a prototype object will always be looked
up before that member will be looked up in it's own prototype object.
David "liorean" Andersson
Received on Friday, 11 April 2008 04:41:36 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:26 UTC