Object.prototype.toString.call(Uint8Array.prototype) throws a TypeError

John-David Dalton john.david.dalton at gmail.com
Fri Aug 29 14:04:57 PDT 2014


> I will fix the handful of standard @@toStringTag getters so they don't
throw

That's rad!

> But I can't really really do anything about user written @@toStringTag
getter that throw or for that matter objects that use Proxies to throw.

Ya, that's fine.

- JDD



On Fri, Aug 29, 2014 at 1:58 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

>
> On Aug 29, 2014, at 12:10 PM, John-David Dalton wrote:
>
> > JS libs/frameworks (jQuery, Dojo, Lo-Dash, Ember, Angular, ...) have
> settled on using Object.prototype.toString.call as a way to determine the
> kind of a value and don't expect that to throw.
> > This is edge case but it seems like an unnecessary gotcha to throw at
> devs.
>
> We've explicitly designed the ES6 O.p.toString to preserve the [[Class]]
> type branding that was proved by prior editions but also decided to
> explicitly not support any new primitive [[Class]]-like brand values.
> Going forward it isn't a reliable way to type check or brand new built-in
> or programmer defined "types".
>
> I will fix the handful of standard @@toStringTag getters so they don't
> throw.  But I can't really really do anything about user written
> @@toStringTag getter that throw or for that matter objects that use Proxies
> to throw.
>
> So, unless you wan to argue for eating exceptions in O.P.toStringm,  that
> possibility will remain but is likely the reflection of a bug or malicious
> code.  Presumablly, such problems can be diagnosed via a debugger
>
> allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140829/8f259a36/attachment.html>


More information about the es-discuss mailing list