- From: liorean <liorean@gmail.com>
- Date: Fri, 11 Apr 2008 06:41:00 +0200
- To: "Web APIs WG (public)" <public-webapi@w3.org>
Hello! 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: <uri:http://www.python.org/download/releases/2.3/mro/> <uri:http://www.webcom.com/haahr/dylan/linearization-oopsla96.html> 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