You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building on #4, if we permit field mappings to be more flexible than an offset, we could also permit custom code to execute. It's not exactly clear what form this should take.
One possibility -- the most flexible, but also most primitive -- would be something that returns a raw pointer to the field that the compiler can use. This would be unsafe code, because the user would have to guarantee the disjointedness requirements.
However, one could also imagine safe code -- we could use the same sort of borrowck rules to check for disjointedness. That would though be rather tricky in that we would want (I imagine) one set of rules that works for either & or &mut borrows.
A use case: In the GNOME mapping, we might want to be able to execute code for locating the "private" fields. Interestingly, this could be made to work in the case of GNOME without any unsafe code, but only if we support shared-only fields (#5). This is because all GNOME private fields would be shared-only. I imagine something like this:
Building on #4, if we permit field mappings to be more flexible than an offset, we could also permit custom code to execute. It's not exactly clear what form this should take.
One possibility -- the most flexible, but also most primitive -- would be something that returns a raw pointer to the field that the compiler can use. This would be unsafe code, because the user would have to guarantee the disjointedness requirements.
However, one could also imagine safe code -- we could use the same sort of borrowck rules to check for disjointedness. That would though be rather tricky in that we would want (I imagine) one set of rules that works for either
&
or&mut
borrows.A use case: In the GNOME mapping, we might want to be able to execute code for locating the "private" fields. Interestingly, this could be made to work in the case of GNOME without any unsafe code, but only if we support shared-only fields (#5). This is because all GNOME private fields would be shared-only. I imagine something like this:
We would type-check this by checking, for each pair of fields, that if you do (effectively):
you don't get any borrowck errors.
The text was updated successfully, but these errors were encountered: