You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not super keen to rely on Proxy, and from what I recall, the primary reason we use new Function is actually for performance. In the case where we know the number of arguments up front, we can generate more optimised code that does not need to copy the arguments pseudo array.
One option might be to add a few prebuilt functions for 0, 1, 2, 3 and 4 arg functions. We could then avoid the runtime code generation until faced with a function that takes a large number of arguments.
In terms of having multiple versions, we so have a version for "domains" support and a version that uses "setImmediate" directly instead of asap. These are generated using the build.js script. We could add another output for content-security-policy compliance, which could either use your Proxy approach, or just skip enforcing the length of returned functions.
I'd like to lockdown
new Function
andeval
in favor ofvm
and other code execution mechanisms that can be checked viarequire
orimport
.This module seems to use them to create
.length
preserving wrapper functions that bridge callback code and Promises.promise/src/node-extensions.js
Line 47 in d980ed0
I think the semantics of denodeify could be implemented without runtime code generation using tricks like the below:
Would you be interested in patches that avoid using
new Function
so can run on runtimes that turn that off?I notice you check compatibility with
promise/.travis.yml
Lines 4 to 7 in d980ed0
How tolerant is this project of feature detecting or loading different
-impl.js
files based on the availability of features likeProxy
?What would you need to see in terms of performance measurement before making a decision?
The text was updated successfully, but these errors were encountered: