Summary
Calling a stdlib namespace method indirectly via .apply() / .call() returns undefined instead of dispatching to the native implementation. The method value reports as a function, but indirect invocation doesn't reach the native impl.
Discovered by the #800 node-core radar (e.g. test-path-join.js uses path.join.apply(...)).
Repro
const path = require('path');
console.log(typeof path.join); // Perry: "function" ✓
console.log(path.join.apply(null, ['a', 'b'])); // Perry: undefined Node: "a/b"
Expected / Actual
- Node:
path.join.apply(null, ['a','b']) === "a/b".
- Perry:
typeof path.join === "function" but .apply() returns undefined.
Likely cause
Perry's stdlib namespace methods are dispatched specially; the function value exists (so typeof is correct) but it isn't a real callable that routes Function.prototype.apply/call back to the native method. Direct calls (path.join('a','b')) work; .apply/.call (and presumably passing the method as a callback) do not.
Context: surfaced running Node's own test/parallel under Perry (#800).
Summary
Calling a stdlib namespace method indirectly via
.apply()/.call()returnsundefinedinstead of dispatching to the native implementation. The method value reports as a function, but indirect invocation doesn't reach the native impl.Discovered by the #800 node-core radar (e.g.
test-path-join.jsusespath.join.apply(...)).Repro
Expected / Actual
path.join.apply(null, ['a','b']) === "a/b".typeof path.join === "function"but.apply()returnsundefined.Likely cause
Perry's stdlib namespace methods are dispatched specially; the function value exists (so
typeofis correct) but it isn't a real callable that routesFunction.prototype.apply/callback to the native method. Direct calls (path.join('a','b')) work;.apply/.call(and presumably passing the method as a callback) do not.Context: surfaced running Node's own
test/parallelunder Perry (#800).