-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Borrow API v1.0 Proposal #44
Conversation
Does Node-API have an API for detaching the backing buffer out of an |
Seems like another drawback is you can’t mutably borrow multiple buffers (with eg a dynamic check they don’t alias or overlap). I don’t know if this is a rare enough use case not to matter. |
@kjvalencik Remind me, does changing the scoped methods to |
Yes, it does with the following constraints:
Unfortunately, this wouldn't work with our current API design. We accept anything that is
It's a drawback of the "simple API" and the reason that the proposal includes a dynamically checked part. It's covered in this section: https://github.com/neon-bindings/rfcs/pull/44/files#diff-f7efd300745a6d0dcd2273fa31a292295151b581fb63b5ae24ef8661f1924520R71
Yes, it does because the scope creates a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great RFC. I left a detailed comment with the results of the conversation we had today about naming and API organization.
This looks great. I'm happy putting it into Final Comment Period. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉🎉🎉
This is a great ergonomic and safety improvement!
The slight incompatible change is a cost, but as we get close to 1.0 this is our last opportunity to make a small number of incompatible changes. We should try to mitigate that cost e.g. by cutting a pre-release and giving people a chance to try out the migration.
Merged in 8beeb16 |
Neon should provide APIs for safely and ergonomically borrowing binary data. Borrowing should leverage the type system for statically checking safety as much as possible without sacrificing flexibility.
Rendered
Implementation: neon-bindings/neon#780
Pre-release published in
0.10.0-alpha.1
.