Another thought: does ES4 provide enough introspection capability to write proxy objects that wrap an immutable class instance? It seems as though it should be possible to create a single class (with * getter/setter functions) that can wrap any object, emulate its interface and provide AOP advice capabilities. If this is indeed possible, would that prove useful for the situations Kris is concerned about?
On Feb 20, 2008, at 7:32 PM, Brendan Eich wrote: > On Feb 20, 2008, at 4:21 PM, Kris Zyp wrote: >> Of course a library function (like dojo.connect) that is called to >> advise a >> method on an object doesn't have control of how the object was >> created. If >> it is an instance of user class (and not dynamic), this function >> will this >> fail. This functionality is pretty core and heavily used by Dojo >> and I >> believe is used by other libraries as well. Of course existing code >> will >> continue to work, but it will be disappointing to find this >> function fail >> for new objects created with ES4 functionality. I don't know an >> easier >> solution, other than real AOP support. > > I think you're assuming a problem of the "Doctor, it hurts when I do > this" variety. Non-dynamic classes are not for everything. Where you > need them as integrity devices, you do not want Dojo's AOP, no way no > how. Most objects will continue to be plain old Object instances. But > note that even in today's world, DOM types are nominal -- there are > non-dynamic classes under the hood. Not all DOM or similar browser > embedding objects can be mutated freely. Dojo survives these hazards, > as far as I know. > > /be > > _______________________________________________ > Es4-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es4-discuss _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
