5 ms·
It's written in…Rust? That's interesting. How is it interacting with Cocoa? EDIT: It looks like it's using the rubrail package, which links with the private DF
by saagarjha 9y ago
It's written in…Rust? That's interesting. How is it interacting with Cocoa?
EDIT: It looks like it's using the rubrail package, which links with the private DFRFoundation framework. rubrail itself is using the objc package. I think this code snippet from the README[1] is enough:
let cls = Class::get("NSObject").unwrap();
let obj: *mut Object = msg_send![cls, new];
let hash: usize = msg_send![obj, hash];
let is_kind: BOOL = msg_send![obj, isKindOfClass:cls];
// Even void methods must have their return type annotated
let _: () = msg_send![obj, release];
Ugh. Why?
[1]https://github.com/SSheldon/rust-objc https://github.com/SSheldon/rust-objc
- kowdermeister 9y agoIt should be still rewritten in rust.
- saagarjha 9y agoWhat? Cocoa, or toucHNews?
- kowdermeister 9y agoIt was just a meta joke :) I hope it can be tolerated.
- TazeTSchnitzel 9y agoThat's basically what Objective-C code looks like when desugared to C.
- saagarjha 9y agoYes, I know that–that's why I'm surprised anyone would go the trouble to write code that way.