On 7/29/2013 4:47 PM, Brendan Eich wrote:
Brandon Benvie wrote:
For value objects, I think it would be problematic if `1m + iframeEval('1m')` or `1m === iframeEval('1m')` didn't work. It would also be a shame if my user-overloaded `new Point(0, 0) + iframeEval('[5, 5]')` didn't work.

Really? How often does cross-frame application arise (never mind application of operator-proxy functions)?

I used iframeEval as an example because it's something we might see now (though I agree with that you it's not common enough to design for). However, I was thinking this could happen pretty easily given the new module system. One might have a few constellations of modules each with their own Loader and intrinsic interacting through function calls (say some set of modules may be sandboxed by an outer application). I don't know that this is something people will actually do, but I thought that one of the features of the module system was to make it possible and easy to do.

You can't have your cake and eat it: either value objects are extensible, in which case realm matters; or they're not extensible, period full stop.

Indeed, I was actually envisioning builtin value objects as being totally frozen, up through the prototype chain. I don't see how you get around the fact that you can't know which realm the return value should come from. I'm guessing you want those prototypes extensible though.

I don't see an issue with using a string to identify a builtin type for user operator overloading though, since you don't end up with multiple copies of the same user type. If my application (which uses multiple realms, like say loading all my third party modules in a sandbox realm), if I can specify how my Point class operator overloads with 'Array', it seems like it should work just fine with any values coming out of those modules. An Array would be identified the same way as it is currently in the ES6 spec: any object that is an Exotic Array Object would match 'Array'; for map, any object that has [[MapData]] matches 'Map', etc (basically how `Object.prototype.toString` figures out what to call something).
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to