Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Improve type safety #37

Closed
brendanzab opened this issue Nov 10, 2014 · 1 comment
Closed

Improve type safety #37

brendanzab opened this issue Nov 10, 2014 · 1 comment

Comments

@brendanzab
Copy link
Contributor

I realise that Objective-C is a very loosely typed language, but it might be easier to work with the API if we enforce some type safety:

pub struct id(libc::intptr_t);
pub const nil: id = id(0);

pub struct NSWindow(id);
pub struct NSString(id);
...

impl Deref<id> for NSWindow { fn deref(&self) -> &id { ... } }
impl Deref<id> for NSString { fn deref(&self) -> &id { ... } }
...

I came up against this when trying to implement invoke_msg_void_NSInteger on NSInteger in #36 because it overlapped with id. It would also improve the documentation.

@brendanzab
Copy link
Contributor Author

Closing - I think I have a better way of doing this now in https://github.com/bjz/objc-rs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant