Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paranoia with Primordials #31

Closed
shadowspawn opened this issue Jan 9, 2022 · 4 comments
Closed

Paranoia with Primordials #31

shadowspawn opened this issue Jan 9, 2022 · 4 comments

Comments

@shadowspawn
Copy link
Collaborator

@ljharb commented in #26

We should probably try to keep this package robust, primordials-style.

I punted and said could we raise a separate issue for that... and here it is!

So, from a state of ignorance, I'll raise some questions:

  1. should we use primordials?
  2. is there a convenient way to make primordials available to current repo code?

I have no experience with the node internals or primordials. I did a quick search for primordials and found:

@ljharb
Copy link
Member

ljharb commented Jan 9, 2022

We don’t have to use node’s actual primordials facility here - but it’d be easy to migrate to it later if we module-level-cached builtins that were call-bound.

Meaning:

const callBound = require('call-bind/callBound');
const slice = callBound('Array.prototype.slice');

/* and later */
slice(arr)

@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Jan 18, 2022

First draft of primordials done in #37, with another PR coming to generalise the support in a reusable way for other polyfill proof of concept projects for easy adoption in node: #37 (comment)

@shadowspawn
Copy link
Collaborator Author

Closing this as we have added and are using primordials.js to allow writing code that will slot into the node environment, which is the main goal.

If we want a robust package for use stand-alone, more work to do.

@shadowspawn
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants