[Harmony proxies] Inheritance safe proxies

# David Bruant (14 years ago)

Le 23/03/2011 11:26, Tom Van Cutsem a écrit :

Hi David,

In one of the first discussion about proxies on this list, the question popped up on whether proxy handlers should implement inheritance (prototype chain walking) themselves, or whether the engine should take care of this, only allowing the handler to control the "own" layer. The consensus back then was to go for the former, as it is more flexible.

I understand and actually strawman:handler_access_to_proxy will help out with this flexibility. However, currently "implementing inheritance" (re-implementing current inheritance or new inheritance patterns) is limited or rather slightly biaised since Object.getPrototypeOf and instanceof are too rigid. My personal feeling on the current approach with instanceof ('hasinstance' trap for the right-hand side constructor) is that it won't be usable in practice (because you need ot mark or list objects). I invite you to read the two first paragraphs of my initial message "[Harmony proxies] Proxies, prototype chain and inheritance". They provide the basics of an alternative to the instanceof strawman. I won't pretend it's better on all aspects, but I think it both approaches are worth discussing. Maybe a solution in between could also be a decent solution too, I don't know.

If I understand correctly, you are proposing to standardize both. I understand the rationale, and inheritance-safe proxies may indeed be what you'd want to use most of the time. But again, in the interest of only standardizing the essential building blocks: can't the abstraction be provided as a library?

My current feeling is that the inheritance issues will prevent us from providing a unique consistent API from which all use cases can be provided as a library. I may have been rushing a bit the discussion. Let's see how the proxy inheritance topic goes with discussions and experiments and we'll be able to answer your question.

Bests,