-
Notifications
You must be signed in to change notification settings - Fork 47
ios: Upgrade to objc2 0.6
and drop block2
#95
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
Conversation
What's the motivation for these changes, particularly the expansion of dependencies? Is there a bug which this addresses? If yes, can you please share more? If not, I wouldn't be inclined to merge this PR, except for the version upgrade. |
From the PR description: to use the latest version of
So you're asking me to drop this from the PR - and not even bother to "share more" - because it's not addressing a bug? I'll go against your request and elaborate the comment from the PR description anyway: It further expands this crates' usage of auto-generated bindings from the The fact that it's a new crate is merely because @madsmtm split out the |
Ugh, I hate to disagree with you @MarijnS95, since you're so passionately defending my crates (I appreciate it ❤️). But I actually superficially agree with @amodm here; there is no free lunch. While we have feature flags for controlling some of this, Besides, And since we don't use the block from use core::ffi::c_void;
use objc2::encode::{Encode, Encoding};
#[repr(transparent)]
struct FakeBlock(*const c_void);
// SAFETY: The type is `#[repr(transparent)]` over a pointer (same layout as `Option<&block::Block<...>>`).
unsafe impl Encode for FakeBlock {
const ENCODING: Encoding = Encoding::Block;
}
fn open_url(
app: &NSObject,
url: &NSURL,
options: &NSDictionary<NSString, AnyObject>,
) {
let fake_handler = FakeBlock(core::ptr::null());
// SAFETY: The signature is correct, we only pass `UIApplication` as the app,
// and the completion handler can be NULL.
unsafe { msg_send![app, openURL: url, options: options, completionHandler: fake_handler] }
} |
Thank you @madsmtm, you've articulated my thoughts perfectly. @MarijnS95, I'm sure you mean well, but while I'm personally encouraging of expanded use of If it's tree duplicates you're running into, any reason why Cargo's |
That mechanism only allows patching crates on the same version, using it to force While I could patch my tree to use my own fork with this update, please explain to me how that precludes opening a PR to share this update with the rest of the world? If anything it's totally undestandable if your stance on updates is "not yet", but now it seems to be "not at all"? I'd be happy to wait and leave this PR open for community visibility until the wider ecosystem requires upgrading - or
Using pregenerated bindings over incomplete handrolled wrappers is definitely a maintainability improvement. |
And usually a compile time regression, sometimes for small crates like this are better served with 1-2 simple hand rolled bindings, it's not like the underlaying objc api will change. |
It does not. I don't know what part of my statement implies so. However, the discretion of acceptance/rejection is mine.
Again, I went through my comment history on this PR, and I have no idea what's giving you this impression. I was very clear that version upgrade is fine, but for expansion of dependencies I want to see a stronger motivation.
Without disagreeing with you entirely, I hold a different opinion on the significance of this. #87 was about doing away with a poorly maintained crate, while this adds a whole new dependency for a tiny change. Hence my question about "what bug it addresses", because the bar for such a change needs to be higher (except for the version upgrade part).
This is fine by me, and was my plan until you closed the PR. To summarise again: version upgrade is fine, expansion of dependencies requires more proof of need. You can choose to keep the PR limited to only the version upgrade in which case I'll merge it immediately (tests passing). Or you can choose to wait until I get more comfortable with expansion of dependencies. |
Even though there's a new `objc2-ui-kit` dependency available that represents the `UIApplication` type and its methods faithfully, there was a strong preference to cut down on the number of dependencies instead so its improved signature has been incorporated here. By extension the `block2` crate was removed too by inlining a simple type definition just to be able to set the `Option<&Block>` to `None`.
objc2 0.6
family of cratesobjc2 0.6
and drop block2
Done, incorporated all your and @madsmtm's requests. |
This is now out as v1.0.4 |
The impeding
objc2 0.6
release series was already hinted at in #94, and is now finally available.Even though there's a new
objc2-ui-kit
dependency available that represents theUIApplication
type and its methods faithfully, there was a strong preference to cut down on the number of dependencies instead so its improved signature has been incorporated here. By extension theblock2
crate was removed too by inlining a simple type definition just to be able to set theOption<&Block>
toNone
.CC @madsmtm