Hey, macOS maintainer of winit here. I've been working on a replacement for objc called objc2, and I think it could be interesting for this crate?
Some of the concrete improvements you'd reap benefit from, mainly in the category "improving correctness":
- Helper macro
msg_send_id! for following cocoa's memory management rules - as a quick example, NSString::new currently leaks because it uses Id::from_ptr instead of Id::from_retained_ptr.
- Implementing
Encode is now required for all types that go across msg_send! - this is great for catching bugs, for example this code in ListView::select_row_indexes is wrong, the type of index is &usize while it should be usize.
- Soundness fixes concerning message sending, autoreleasepools and reference counting.
I have an implementation of Foundation that you may be interested in using, at the very least it can be useful as an example of how to use objc2 well.
See also my PR to the core-foundation-rs project.
Opening this issue to start the discussion, am a bit tired so sorry it's not more detailed. I would really like to work towards a completely safe interface over (the most commonly used parts of) Cocoa, but wanted to keep it out of the scope of objc2 itself - cacao seems like a nice work in that direction, would like to help out in this effort (other than just working on objc2).
Hey, macOS maintainer of
winithere. I've been working on a replacement forobjccalledobjc2, and I think it could be interesting for this crate?Some of the concrete improvements you'd reap benefit from, mainly in the category "improving correctness":
msg_send_id!for following cocoa's memory management rules - as a quick example,NSString::newcurrently leaks because it usesId::from_ptrinstead ofId::from_retained_ptr.Encodeis now required for all types that go acrossmsg_send!- this is great for catching bugs, for example this code inListView::select_row_indexesis wrong, the type ofindexis&usizewhile it should beusize.I have an implementation of
Foundationthat you may be interested in using, at the very least it can be useful as an example of how to useobjc2well.See also my PR to the
core-foundation-rsproject.Opening this issue to start the discussion, am a bit tired so sorry it's not more detailed. I would really like to work towards a completely safe interface over (the most commonly used parts of) Cocoa, but wanted to keep it out of the scope of
objc2itself -cacaoseems like a nice work in that direction, would like to help out in this effort (other than just working onobjc2).