Skip to content

.apply()/.call() on stdlib namespace methods returns undefined (path.join.apply, etc.) #1722

Description

@proggeramlug

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions