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

Let's say realms connected via property references (window.frames[0], e.g.) or addressable by window.open form a realm-clique, sometimes called a constellation -- too long, how about "world" (set of realms reachable from one or more members of the set).

What world is the locus of operator overloads including typeof? This is not something we've spec'ed for ES6.


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

I got that, it's a nice API -- but it requires us to define world-of-realms-that-can-share-references, no?

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to