David-Sarah Hopwood wrote: > Mark S. Miller wrote: >> 2009/2/10 Allen Wirfs-Brock <[email protected]> >>> #2 Why allow "Object" for host objects that are required to conform to the >>> section 15.3 specification for Object. If they are distinguishable from >>> section 15.3 objects they should have [[Class]]=="Object". An >>> implementation can use "HostObject" or something else. (Counter-argument: >>> Might confuse some programmers??? (seems weak)) >> I like your #2 direction a lot. If it were feasible to require that host >> objects not even use [[Class]] "Object", I'd be in favor. However, I'm >> guessing that would differ too greatly from current browser behavior to have >> a chance. > > Remember that, apart from algorithms that check whether [[Class]] is > "Function", "Date" or "RegExp"
or "Array" [but that doesn't affect my point] Note that the algorithms in the JSON section check whether [[Class]] is "Array" directly; they should probably be using Array.isArray. > , the only other observable effect of > [[Class]] is on the *default* implementation of toString(). A host object > can override toString() anyway. > > A *reliable* way of distinguishing native from host objects, say an > Object.isNativeObject(o) method, might actually be useful for secure > subset runtimes, but one that can be overridden is not. -- David-Sarah Hopwood ⚥ _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

