jasnell / proposal-istypes

TC-39 Proposal for additional is{Type} APIs
201 stars 7 forks source link

Make `Symbol.builtin` value a function #23

Closed jasnell closed 7 years ago

jasnell commented 7 years ago

Hopefully the updates we discussed :-)

/cc @ljharb @bengl

jasnell commented 7 years ago

What would be extra useful is if every JS Symbol.builtin function was the same identical function, i.e., via === since it's just exposing the value of the internal slot.

Just so I'm clear... Even across realms?

const builtInFn1 = Date[Symbol.builtin];
const builtInFn2 = vm.runInNewContext('Uint8Array[Symbol.builtin]');

const yes = builtInFn1 === builtInFn2;   // true
ljharb commented 7 years ago

Oh, no not across realms - that'd be a communication channel. Just within the same realm (the way Array.prototype.values === Array.prototypr[Symbol.iterator])

jasnell commented 7 years ago

@ljharb ... updated! please take a look.

jasnell commented 7 years ago

Landed!