In this post I will give an overview of Javascript's object model. To a first approximation, by "object model", I mean the mental model that a developer has of an object's structure and behavior. At the end, I will hint at how proxies can be used to implement (variations on) this object model in Javascript itself.
For the past two years, I have been working on a new Reflection API for ECMAScript (the Javascript standard) together with Mark Miller. Its most novel feature is its support for proxies, objects whose behavior in response to a large number of built-in functions and operators can be controlled in Javascript itself.
Last week, I finally finished a paper that not only describes the new API in some detail, but also describes the principles that helped steer our design.
Andreas Gal from Mozilla is implementing the Proxy API that I developed at Google in collaboration with Mark S. Miller. This API enables the creation of dynamic proxies that can intercept a variety of operations applied to Javascript objects. Proxies are currently available in the Firefox 3.7a pre-release and are scheduled to be included in the next Ecmascript standard. I am in the process of writing up a small tutorial to introduce this new feature.