JSON support for BigInt in Chrome/V8

Jordan Harband ljharb at gmail.com
Wed Jul 18 03:38:11 UTC 2018


You can permanently fix any such type-checks by `function isObject(x) {
return x && (typeof x === 'object' || typeof x === 'function'); }`, or
`function isObject(x) { return x && Object(x) === x; }`, etc.

On Tue, Jul 17, 2018 at 7:05 PM, Kai Zhu <kaizhu256 at yahoo.com> wrote:

> >You already can't use `new` with `Symbol`, and you don't ever want to use
> `new` with a primitive's constructor anyways.
>
> this would be *okay* if we limit the number of primitive-types in the
> language to a small-number (maybe add BigDecimal, but that's it), so its
> easy to remember.  i'm concerned that we have one too many needless
> primitives already (Symbol should've been an object, and it not requiring
> 'new' looks more like a wart to me).
>
> adding more primitives at this point, will only make this pedantic-rule
> look more like a wart, and trip-up beginners (and their prejudice on the
> language's inconsistencies).  it also complicates integration-work on
> web-projects, due to difficulty baton-passing new primitives around via
> JSON, and having to continually refactor type-checks that rely on typeof.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180717/ab67d240/attachment-0001.html>


More information about the es-discuss mailing list