core-foundation-rs icon indicating copy to clipboard operation
core-foundation-rs copied to clipboard

Replace `objc` with `objc2`

Open madsmtm opened this issue 1 year ago • 5 comments

Redo of https://github.com/servo/core-foundation-rs/pull/513, see that for previous discussion and motivation (GitHub Actions was giving me trouble).


I've focused on making this PR as minimal as possible, that is, I'm explicitly not trying to actually use any of the new features that objc2 offers - we can discuss those separately as we get there. So as-is, this PR is only a small improvement on the status quo, though still definitely an improvement.

The main difference you have to know for now is that all arguments and return types must implement a specific marker trait objc2::encode::Encode, which makes it possible to catch type mistakes at runtime, when debug assertions are enabled (e.g. cases of passing an u32 where an isize was expected). This is a huge boon to soundness, and the few mistakes I've found and corrected are likely only the tip of the iceberg - I could use someone's help to run this on bigger code-bases that exercise more of cocoa/cocoa-foundation.

Feel free to ask any questions about anything!

CC recent contributors @jrmuizel, @mukilan, @jdm and @michaelwright235.

madsmtm avatar Jul 31 '23 12:07 madsmtm