Mads Marquart

Results 394 comments of Mads Marquart

The primary motivator for this is to make a safe function using `NSString`'s `UTF8String` that can return a `&str` without (external) cloning. The [documentation on `UTF8String`](https://developer.apple.com/documentation/foundation/nsstring/1411189-utf8string?language=objc) is a bit sparse...

A simpler (but also more restricting) version than all the thread local stuff in debug mode could also just be to use some other unsafe auto trait that `AutoreleasePool` isn't,...

I agree that it's formatting is suboptimal, but it's better than nothing, and some things it definitely does better (like putting the explicit `"C"` on `extern` items, considering the maybe...

Mostly it just confused me since all the other types worked the other way. But I think it actually would make the workings of `Sel` more explicit: Since `Sel::register` would...

I don't think the ergonomics suffer that bad, in my view this is actually better since makes it clear that `msg_send` isn't consuming the `Id`, but simply using the pointer...

I think it's a good idea to have unstable features like these, since it gives nightly users (like myself :wink:) the option to test it out on their code beforehand,...

`alloc::rc::Weak` is actually `core::ptr::NonNull` internally - they use dangling pointers to create a `Default` implementation. But yeah, `WeakPtr` could probably have a `Default` impl of `WeakPtr::new(core::ptr::null_mut())`, but I don't think...

> Fewer places in user code where `unsafe` is necessary. > Improved ergonomics, e.g. seamless conversion between basic types `msg_send!` and such cannot be made safe, because we cannot verify...

A few more examples of usage: ```rust struct MyObject { _data: [u8; 0], // Should maybe be UnsafeCell? } // On nightly: extern type MyObject; let obj: Owned = unsafe...

After making this I discovered [objc-id](https://github.com/SSheldon/rust-objc-id), which does much of what I wanted, and https://github.com/SSheldon/rust-objc/issues/24 which details why this is a separate crate - but there's still some improvements I'd...