Standard builtins' prototypes and toString

Brendan Eich brendan at
Wed Jun 18 14:38:23 PDT 2014

Allen Wirfs-Brock wrote:
> Mostly about establishing the pattern for what should be done for other toString methods that are applied to the wrong kind of object or a non-instance prototype.  Not every object that could get a custom toString has a natural "0-value".

Don't let the tail wag the dog here.

That's on top of "avoid risk you can't size easily and don't need".

> For example, what should Symbol.prototype.toString() do? (b) sounds like a good choice for it.  (c) is certainly ok, for Date.prototype but but we have other cases that need to be addressed.

Symbol.prototype could even throw, it's such an outlier. Throw if no 
"zero" might go a long way, cover most of the dog.


More information about the es-discuss mailing list