Expose whether an `ArrayBuffer` is detachable
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- compilers
Hướng nghiên cứu
Bắt đầu bằng việc xem xét các quy tắc detachability hiện tại của ArrayBuffer và hành vi của transfer() được mô tả trong issue này. Đánh giá xem một thuộc tính boolean về detachability có phù hợp với proposal hay không, bao gồm polarity đã nêu và trường hợp WebAssembly.Memory; hoàn thành nghĩa là đưa ra và ghi lại một quyết định về đặc tả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
There is a pre-existing problem with ArrayBuffers in that it is not always possible to determine up-front whether or not a particular instance will succeed in being detached when asked to be transferred. Prior to this proposal, the notable case of an undetectable non-detachable buffer was the buffer exposed by WebAssembly.Memory. (This is as opposed to SharedArrayBuffer, which can be detected via instanceof.)
This proposal adds a new reason that an ArrayBuffer might not be detachable, and it requires a kind-specific check (.immutable) to make the detachability determination. And it seems likely that this won't be the last kind of buffer that won't be detachable.
I'd like to suggest that the fact of detachability be directly represented as a detachable: boolean property. It would be true exactly when a request to transfer() would succeed based on the detachability criterion. The choice of polarity here is intentional, in that an implementation without the property would fail-safe in terms of client code trying to decide between copy or transfer.
To be clear, it is currently possible to recover from a failed transfer with try-catch if one is trying to implement copy-or-transfer. However, that means that a correct case would have to accept the inefficiency of generating and catching an exception. And beyond that inefficiency, it does not make for particularly ergonomic code. And, in general, it's just plain useful to be able to make the determination without actually trying.
I actually ran into exactly this case (wrt WebAssembly.Memory) and during my search for a resolution ended up finding this proposal. So I figured it'd be worth raising the suggestion here. In my case, it was preferable to accept that my code will throw rather than silently degrade performance (punting the performance problem to the caller), but I'd really rather not be in the position to have to make that tradeoff.
- Ngôn ngữ chính
- JavaScript
- Star
- 38
- Fork
- 7
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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.
Issue khác của tc39/proposal-immutable-arraybuffer
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Web platform integration Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
tc39/proposal-immutable-arraybuffer#43 · 2 bình luận ·
-
Review Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
tc39/proposal-immutable-arraybuffer#30 · 12 bình luận ·
-
Zero-copy operations on the web Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
tc39/proposal-immutable-arraybuffer#18 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
tc39/proposal-immutable-arraybuffer#16 · 2 bình luận ·
Tất cả issue của tc39/proposal-immutable-arraybuffer
Issue tương tự
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Improve Title Support Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·