Title: Enforce callback signatures with C++ Concepts · Issue #1746 · nodejs/node-addon-api · GitHub
Open Graph Title: Enforce callback signatures with C++ Concepts · Issue #1746 · nodejs/node-addon-api
X Title: Enforce callback signatures with C++ Concepts · Issue #1746 · nodejs/node-addon-api
Description: #1738 documented the required signature of the templated finalizer callback parameters as inline comment hints. These are human-only annotations. The compiler does not enforce them, so a mismatched callable fails deep inside the template...
Open Graph Description: #1738 documented the required signature of the templated finalizer callback parameters as inline comment hints. These are human-only annotations. The compiler does not enforce them, so a mismatched...
X Description: #1738 documented the required signature of the templated finalizer callback parameters as inline comment hints. These are human-only annotations. The compiler does not enforce them, so a mismatched...
Opengraph URL: https://github.com/nodejs/node-addon-api/issues/1746
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enforce callback signatures with C++ Concepts","articleBody":"#1738 documented the required signature of the templated finalizer callback parameters as inline comment hints.\n\nThese are human-only annotations. The compiler does not enforce them, so a mismatched callable fails deep inside the template instantiation with an unhelpful error.\n\nOnce C++20 is the minimum supported standard, we should replace these hints with C++ Concepts that constrain the `Finalizer`/`FinalizerType` template parameters. This gives compiler-enforced contracts and clear diagnostics at the call site.\n\nFinalizer candidates:\n- `BasicEnv::PostFinalizer`\n- `Object::AddFinalizer`\n- `External::New`\n- `Buffer::New` / `Buffer::NewOrCopy`\n- `ThreadSafeFunction::New`\n- `TypedThreadSafeFunction::New`\n\nCallback candidates:\n- `Function::New` — the JS callback (`Callable`)\n- `PropertyDescriptor::Accessor` — `Getter` / `Setter`\n- `PropertyDescriptor::Function` — `Callable`\n- `ThreadSafeFunction::BlockingCall` / `NonBlockingCall` — `Callback`\n- `TypedThreadSafeFunction::BlockingCall` / `NonBlockingCall` — `Callback`\n- `TypedThreadSafeFunction` — the `CallJs` callback","author":{"url":"https://github.com/legendecas","@type":"Person","name":"legendecas"},"datePublished":"2026-08-10T21:13:02Z","url":"https://github.com/nodejs/node-addon-api/issues/1746"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0e0e7ccf-6414-2d50-cc49-635542c62f47 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A838:335506:A853F8:E0FAF6:6B0641B9 |
| html-safe-nonce | 56262e5e91463b6e9678d780ddf53e104fbf436fdb4ad9375d3a22dc51785726 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODM4OjMzNTUwNjpBODUzRjg6RTBGQUY2OjZCMDY0MUI5IiwidmlzaXRvcl9pZCI6IjUxNjg0MjI3NjY1Nzk2OTYwNTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 13fb8a4f83eaf197801c5596454a4e3c90090daa995a29ca01f3cbdf7f76dd4d |
| hovercard-subject-tag | issue:5114410590 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node-addon-api/1746/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e1ce27d1f5de1f889856e935d68e8e830dbd8fe3270ec8fc79812c5f2761ee2c/nodejs/node-addon-api/issues/1746 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e1ce27d1f5de1f889856e935d68e8e830dbd8fe3270ec8fc79812c5f2761ee2c/nodejs/node-addon-api/issues/1746 |
| og:image:alt | #1738 documented the required signature of the templated finalizer callback parameters as inline comment hints. These are human-only annotations. The compiler does not enforce them, so a mismatched... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | legendecas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node-addon-api git https://github.com/nodejs/node-addon-api.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 81384578 |
| octolytics-dimension-repository_nwo | nodejs/node-addon-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81384578 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node-addon-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width