I'm not sure why anything needs remembering - with no other knowledge
except "how the thing you're trying to create is used", I'd hope that it's
apparent whether it's an object or a primitive.

On Thu, Jul 19, 2018 at 2:43 PM, kai zhu <[email protected]> wrote:

> reposting due to previous mail-rejection (vpn issue with gmail in china)
>
> >You already can't use `new` with `Symbol`, and you don't ever want to use
> `new` with a primitive's constructor anyways.
>
> this rule 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 already concerned that we have one too
> many needless primitives (Symbol should've been an object similar to
> Promise, and even more so since its use-case is marginal).
>
> 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.
>
>
>
> On 7/17/18, Andrea Giammarchi <[email protected]> wrote:
> > fair enough, so everything that is not `object` or `null` should never
> use
> > `new`. Is this somehow an indirect rule based on current specs or
> actually
> > part of the specification?
> >
> >
> >
> > On Tue, Jul 17, 2018 at 11:12 AM J Decker <[email protected]> wrote:
> >
> >>
> >>
> >> On Tue, Jul 17, 2018 at 1:48 AM Andrea Giammarchi <
> >> [email protected]> wrote:
> >>
> >>> We miss a fundamental feature in JS, the ability to understand if a
> >>> native constructor can be used with `new` or not.
> >>>
> >>> BigInt("5555555555555555555555555500003");
> >>> 5555555555555555555555555500003n
> >>>
> >>> new BigInt("5555555555555555555555555500003");
> >>> VM51:1 Uncaught TypeError: BigInt is not a constructor
> >>>
> >>>
> >> ```
> >> typeof(5n)
> >> "bigint"
> >>  ```
> >>
> >> Uint8Array([])
> >>> VM54:1 Uncaught TypeError: Constructor Uint8Array requires 'new'
> >>>
> >>> new Uint8Array([])
> >>> Uint8Array []
> >>>
> >>> Without that knowledge, any attempt to even think about a solution that
> >>> would scale not only with BigInt but with everything else, is kinda
> >>> futile.
> >>>
> >>> Best Regards.
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to