-
Notifications
You must be signed in to change notification settings - Fork 79
Description
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 usesId::from_ptr
instead ofId::from_retained_ptr
. - Implementing
Encode
is now required for all types that go acrossmsg_send!
- this is great for catching bugs, for example this code inListView::select_row_indexes
is wrong, the type ofindex
is&usize
while it should beusize
. - 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
).