-
Notifications
You must be signed in to change notification settings - Fork 224
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
New standard proposal #5498
New standard proposal #5498
Conversation
This reverts commit dc96bff.
}); | ||
} | ||
// SAFETY: FunctionParameter and BNFunctionParameter are transparent, | ||
// so this can be safelly transmuted |
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.
safelly -> safely
so overall, I'm not really a fan of doing away with the The current system where API users can't ever directly own the wrapper objects (meaning they either see them through a reference or through a Ref<> that they own) provides a lot of clarity especially for those of us who work on both sides of the API boundary. I'm fine on being more consistent about into_raw/from_raw/etc. and establishing clear conventions I think in general we're better off not transmuting and just wrapping explicitly with newtypes, that way we can rework the internals of any wrappers and it's never going to result in user-facing changes at all. |
There are many problems with having an Ref:
The ownership separation is very different from
If a type always and only exists as
Exposing the
That's exactly my idea, I'm not exactly deleting the
My philosophy for FFI is always build safe object, that is as close as possible to zero-cost. Although it's usually more complex at first, you will notice that any early-abstractions have a tendency on create more complexity. The pilling up of complexity have a tendency to show up on iterators and other kinds of high level abstractions. Eg the |
This is an proposal to standardize the inner-workings of the API, specially with the FFI types.
Mostly it consist of creating standard functions to create/manger FFI wrapper types, such as functions
into_raw
,as_raw
,from_raw
,ref_from_raw
, the use ofNonNull<T>
instead of the naked pointer, hide inner representations, etc.This don't necessarily has the objective of being merged, but act like a guide to new implementations.