On 7/29/2013 5:20 PM, Brendan Eich wrote:
Honing in on disagreement (rest is ok).

Brandon Benvie wrote:
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

Including modules loaded in other realms?

If it's considered a valid use case (sandbox realms/multirealm setups). I thought it was a goal just based on the design of the module system but that may be an incorrect idea.

. 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).

How can user-code make a Map-like that has [[MapData]]?

I just mean an instance of a Map or a class that extends Map. Essentially all I'm saying is that you match by [[Class]] (which doesn't exist in ES6, but a heuristic to determine what is essentially [[Class]] does exist).

defineOperator('+', addPointAndArray, Point, Array) // matches only this realm's Arrays defineOperator('+', addPointAndArray, Point, 'Array') // matches any realm's Arrays, [[Class]]

Basically, if `Array.isArray(rhs)` is true, I'd want it to match `'Array'` in operator overloading.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to