nodejs / nodejs/node-addon-api
Enforce callback signatures with C++ Concepts
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 2.4k
- Forks
- 499
- Ø Merge
- 2 T. 11 Std.
- Gemergte PRs (30 T.)
- 2
Beschreibung
#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 instantiation with an unhelpful error.
Once 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.
Finalizer candidates:
BasicEnv::PostFinalizerObject::AddFinalizerExternal::NewBuffer::New/Buffer::NewOrCopyThreadSafeFunction::NewTypedThreadSafeFunction::New
Callback candidates:
Function::New— the JS callback (Callable)PropertyDescriptor::Accessor—Getter/SetterPropertyDescriptor::Function—CallableThreadSafeFunction::BlockingCall/NonBlockingCall—CallbackTypedThreadSafeFunction::BlockingCall/NonBlockingCall—CallbackTypedThreadSafeFunction— theCallJscallback
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Überprüfe die Inline-Signaturannotationen aus #1738 und die aufgeführten Template-Einstiegspunkte, einschließlich BasicEnv::PostFinalizer, Object::AddFinalizer, External::New, Buffer::New und der ThreadSafeFunction-APIs. Bestimme die erforderlichen Einschränkungen für jeden Finalizer-, Callable-, Getter-, Setter- und Callback-Kandidaten. Als abgeschlossen gilt die Aufgabe, wenn C++20 Concepts die dokumentierten Signaturen erzwingen und Diagnosen an der Aufrufstelle erzeugen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- api
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100