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

Proper bool handling #239

Merged
merged 8 commits into from
Aug 28, 2022
Merged

Proper bool handling #239

merged 8 commits into from
Aug 28, 2022

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Aug 13, 2022

4 real this time: Automatic conversion of bool to/from the Objective-C BOOL across message sends.

Yes, it's unclean, and yes, it couples objc2-encode to the runtime (which it will have to be anyhow to handle bitfields properly), and feels like a lot of work for a little thing, but it's simply just a huge productivity boost to never again have to worry about bool being special!

Unblocks #217, with this it suddenly becomes much more useful!

Original idea in #126, dismissed back then because of complexity.

Random notes to myself:

  • Initial implementation
  • Should not be allowed in extern "C" fn(bool) in add_method (EncodeArguments)
  • Document special handling of bool in Ivar
  • Document in general
  • Figure out how to cfg guard the stuff in objc2-encode and objc-sys properly

@madsmtm madsmtm added enhancement New feature or request A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates labels Aug 13, 2022
@madsmtm madsmtm added this to the objc2 v0.3 milestone Aug 13, 2022
@ArturKovacs
Copy link

This is awesome!

@madsmtm madsmtm mentioned this pull request Aug 14, 2022
3 tasks
This was referenced Aug 16, 2022
@madsmtm madsmtm force-pushed the bool-handling branch 4 times, most recently from 6f724af to 4c633d3 Compare August 28, 2022 15:40
@madsmtm madsmtm marked this pull request as ready for review August 28, 2022 15:40
@madsmtm madsmtm force-pushed the bool-handling branch 3 times, most recently from ecfb88c to b2d67cf Compare August 28, 2022 16:03
@madsmtm madsmtm merged commit 43c1d8a into master Aug 28, 2022
@madsmtm madsmtm deleted the bool-handling branch August 28, 2022 19:20
madsmtm added a commit to madsmtm/cacao that referenced this pull request Aug 29, 2022
madsmtm added a commit to madsmtm/cacao that referenced this pull request Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants