Axel Rauschmayer wrote:
Suggestion: put this evolving spec into a Gist or something similar.

Definitely -- trying not to work all weekend, s'all. Also practicing release-early/often on es-discuss.

Thanks for reading! Any other comments?

/be

On Jul 28, 2013, at 23:24 , Brendan Eich <[email protected] <mailto:[email protected]>> wrote:

Brendan Eich wrote:
Function.setTypeOf(V, U)

1.  Let S = ToString(U)
2.  Let T = V
3.  If T is null then
3a.   If S is not "null" and S is not "object", throw
4.  Else
4a.   If T is not a value object constructor, throw
4b.   T = T.prototype
4c.   If TypeofToExemplarMap.has(S), throw
5.  Call TypeofToExemplarMap.set(S, T)
6.  Call ExemplarToTypeofMap.set(T, S)

Correction, see new 4b below:

1.  Let S = ToString(U)
2.  Let T = V
3.  If T is null then
3a.   If S is not "null" and S is not "object", throw
4.  Else
4a.   If T is not a value object constructor, throw
4b.   If T and Function are not same-realm, throw
4c.   T = T.prototype
4d.   If TypeofToExemplarMap.has(S), throw
5.  Call TypeofToExemplarMap.set(S, T)
6.  Call ExemplarToTypeofMap.set(T, S)

I did not add an exception when the current evaluation context's realm is not the same as Function's -- that seems too restrictive, forbidding script in the main window from fixing up typeof for same-origin code that it loads into an iframe.

Again, comments welcome (cc'ing Allen since he is realm-master; ES1-5 left realm implicit and singular, contrary to reality in browsers).

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


--
Dr. Axel Rauschmayer
[email protected] <mailto:[email protected]>

home: rauschma.de <http://rauschma.de>
twitter: twitter.com/rauschma <http://twitter.com/rauschma>
blog: 2ality.com <http://2ality.com>

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

Reply via email to