Standard builtins' prototypes and toString

Brendan Eich brendan at mozilla.org
Wed Jun 18 16:12:43 PDT 2014


Allen Wirfs-Brock wrote:
> The spec. current says throw for this Symbol.prototype case.  The 
> (reasonable) opposing view is that toString should never throw.  Other 
> than the protoype-is-not-an-instance it all about unlikely edge cases 
> where toString methods are applied to the wrong kind of object.

js> Object.create(null).toString()
typein:1:0 TypeError: Object.create(...).toString is not a function

It happens. Better to catch that error (Symbol.prototype flowing into an 
implicit conversion) early?

/be


More information about the es-discuss mailing list