nodejs / nodejs/node-addon-api
Enforce callback signatures with C++ Concepts
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 2.4k
- Fork
- 499
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 2
Mô tả
#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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Rà soát các chú thích chữ ký inline từ #1738 và các điểm vào template được liệt kê, bao gồm BasicEnv::PostFinalizer, Object::AddFinalizer, External::New, Buffer::New và các API của ThreadSafeFunction. Xác định các ràng buộc cần thiết cho từng ứng viên Finalizer, Callable, Getter, Setter và Callback. Hoàn thành có nghĩa là C++20 Concepts thực thi các chữ ký được ghi trong tài liệu và tạo ra chẩn đoán tại vị trí gọi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- api
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100