Standard builtins' prototypes and toString

C. Scott Ananian ecmascript at cscott.net
Thu Jun 12 08:57:02 PDT 2014


On Thu, Jun 12, 2014 at 11:42 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
> TC39 explicitly agreed that we would move away from the "a prototype is an instance of its constructor" model, except where there was known legacy usage that we had to support. That previous model make it very difficult to generalize the initialization of prototype objects created via class declarations.

Right, which is why I'm saying I don't understand the problem with
`Date.prototype.toString()`.  It's not a `Date`, it's a
`Date.prototype`.  Throwing an error is more informative than hiding
it and returning something arbitrary.  As has been mentioned,
debuggers have to deal with the fact that `toString` can have
side-effects, throw exceptions, etc, anyway.  What problem are we
actually solving here?
  --scott


More information about the es-discuss mailing list