Skip to content

ffi: remove function signature property aliases#63482

Open
Renegade334 wants to merge 2 commits into
nodejs:mainfrom
Renegade334:ffi-dealias-signatures
Open

ffi: remove function signature property aliases#63482
Renegade334 wants to merge 2 commits into
nodejs:mainfrom
Renegade334:ffi-dealias-signatures

Conversation

@Renegade334
Copy link
Copy Markdown
Member

@Renegade334 Renegade334 commented May 21, 2026

Refs: https://github.com/nodejs/node/pull/62072/changes#r3067834658

Having multiple property name aliases for function signature objects doesn't add utility, but from a TS perspective, it blocks being able to infer the resultant function type from the shape of the signature object. With all else being equal, it'd be useful to get rid of them.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels May 21, 2026
@Renegade334 Renegade334 added the ffi Issues and PRs related to experimental Foreign Function Interface support. label May 21, 2026
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
@Renegade334 Renegade334 force-pushed the ffi-dealias-signatures branch from 35c2eee to 52cedc7 Compare May 21, 2026 23:15
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.13%. Comparing base (2f56cd2) to head (fc33b1a).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/ffi-shared-buffer.js 93.02% 3 Missing ⚠️
src/ffi/types.cc 60.00% 0 Missing and 2 partials ⚠️
src/node_ffi.cc 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63482      +/-   ##
==========================================
- Coverage   90.17%   90.13%   -0.05%     
==========================================
  Files         718      718              
  Lines      227731   228342     +611     
  Branches    42768    42919     +151     
==========================================
+ Hits       205365   205807     +442     
- Misses      14145    14274     +129     
- Partials     8221     8261      +40     
Files with missing lines Coverage Δ
src/node_ffi.cc 70.05% <91.66%> (+0.04%) ⬆️
src/ffi/types.cc 46.91% <60.00%> (-2.01%) ⬇️
lib/internal/ffi-shared-buffer.js 98.83% <93.02%> (-0.22%) ⬇️

... and 64 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread doc/api/ffi.md
* `result`, `return`, or `returns` for the return type.
* `parameters` or `arguments` for the parameter type list.
* `result` {string} A [type name][type names] specifying the return type of the
function or callback. **Default:** `'void'`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I can cast a vote for keeping return instead of result, I'd like to do so – that's just generally more in line with what the standardized terminology around function signatures is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if I have to pick one I'd go for return and arguments.
@Renegade334 Are you fine with doing so?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, if @addaleax concurs I think you can continue with the changes.

@Renegade334 Renegade334 force-pushed the ffi-dealias-signatures branch 2 times, most recently from d2f2716 to dc9a62b Compare May 23, 2026 16:40
@Renegade334 Renegade334 force-pushed the ffi-dealias-signatures branch from dc9a62b to fc33b1a Compare May 23, 2026 16:41
ERR_INTERNAL_ASSERTION,
},
} = require('internal/errors');
const assert = require('internal/assert');
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of the assertions had to be modified anyway with this changeset, so as a driveby I've changed them all to the canonical internal assertion pattern.

@ShogunPanda ShogunPanda added the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants