-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newtypes instead of monolithic id #173
Comments
I've had some success with this inside my own bindings, and I can definitely see the use for this here. |
Update bitflags to 1.0 and bump version <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/173) <!-- Reviewable:end -->
I'll start working on this. |
This is also of interest to me, and I would like to know how I can help. |
I think the best way to help would be to convert a couple representative modules to use newtypes and make a pull request so we can evaluate the tradeoffs of doing the full conversion. Nobody else is actively looking into it right now. |
Seems simple enough. I could start by converting everything involved with the Hello World app. My attempts are going to be pretty naive to begin with. I have no experience with Cocoa programming outside of a few tools and an attempt that I made over the weekend of creating a type-safe wrapper around this library. For memory management purposes, I was turning off the autorelease pool. I'm assuming I need to make the objects part of the Rust borrow system and avoid having the OS deallocate the object IDs that the Rust types are pointing to. Is this reasonable? |
I honestly don't have enough Cocoa experience to answer that question, unfortunately. Maybe @jrmuizel does? |
Then I'll just dig in over the next few days, do my best, and let y'all tell me if I've gone wrong. |
I've prototyped this. The process looks long and tedious the way I'm doing it, but I'm also doing it more in the sense of a Rust API instead of mimicking the Objective C API directly. I've created a submodule named https://github.com/savannidgerinel/core-foundation-rs/tree/cocoa-safe I welcome comments. However, this is probably too big to manage as just a single issue. |
Sunday Feb 28, 2016 at 16:40 GMT
Originally opened as servo/cocoa-rs#117
Is there any reasoning for using traits and implementing them onto
id
rather than creating newtypes such asstruct NSString(id)
? I've been running into name collisions with the former a lot lately.The text was updated successfully, but these errors were encountered: