Skip to content
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

Plan for higher-level bindings? #79

Open
ubolonton opened this issue Apr 8, 2019 · 1 comment
Open

Plan for higher-level bindings? #79

ubolonton opened this issue Apr 8, 2019 · 1 comment

Comments

@ubolonton
Copy link

By "high level", I mean:

  • Fewer places in user code where unsafe is necessary.
  • Improved ergonomics, e.g. seamless conversion between basic types, block <-> closure, exception <-> Result.

Do you think they belong to this crate? Or maybe it's the job of bindgen and the layers above?

I also found several related efforts:

How do you think their approaches compare to this? Can we combine the efforts somehow?

@madsmtm
Copy link

madsmtm commented Jun 14, 2021

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 that the selector's arguments are correct.

But other crates like objc-foundation goes some of the way of implementing safe abstractions on Foundation types (fruity also deserves a mention here).

block <-> closure

block exists and can currently safely provide the closure -> block part, and maybe in the future block -> closure.

exception <-> Result

There exists objc_exception, but it actually causes UB until the ffi-unwind project group progresses further.

Can we combine the efforts somehow

  • objrs takes a completely different approach (we use the dynamic API, they declaratively / statically create classes), but the ideas might get integrated into this project at some point when they're more stable.
  • I think RustKit is dead?
  • bindgen might be a viable approach for some of the ergonomics, hadn't considered that before, thanks for the link!

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

No branches or pull requests

2 participants