Standard builtins' prototypes and toString
till at tillschneidereit.net
Thu Jun 19 12:07:29 PDT 2014
On Thu, Jun 19, 2014 at 8:16 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
> On Jun 19, 2014, at 10:46 AM, C. Scott Ananian wrote:
> While we're on the topic, shall we discuss `valueOf()`? Should it get the
> same treatment?
> I don't think so. To me, toString is a special case because it is
> explicitly applied so often, particularly for debugging purposes.
> But valueOf is primarily invoked for implicit conversions in expressions.
> Like I described earlier in this thread, TC39's assumption when it agreed
> to this ES design change was that the web did not generally depend upon
> using these existing ES3 generation (or earlier) prototypes as instance
> objects. In the case where we know that wasn't true (Function.prototype)
> we intentionally did not change the prototype to being a non-instance
> object. We also agreed if we discovered other such dependencies we would
> change those prototypes back to being instance objects.
> Discovering that one of these prototypes objects were being routinely used
> in expression contexts where valueOf was being implicitly applied would be
> evidence that that prototype needed to be handled in the legacy manner.
> But, we don't have any new evidence of that being the case. Until there is
> some evidence, there isn't any reason to second guess the original analysis
> and TC39's decision.
Ok, we'll try this in Nightly for Date.prototype and see if the assumption
holds. If it does, we'll continue with the rest.
I don't really know if Date.prototype is a good canary, but it's what I
have a mostly-finished patch for, and it doesn't seem to make too much of a
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss