Skip to content

extern_class! macro #188

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

Merged
merged 3 commits into from
Jul 6, 2022
Merged

extern_class! macro #188

merged 3 commits into from
Jul 6, 2022

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Jul 5, 2022

Taken out of #161.

Rename object! macro to extern_class!, use derive directly for things that can be derived (instead of us having to implement PartialEq and so on manually), and expose the macro publicly.

This macro will greatly help consumers create their own Objective-C classes. For example, I'd like to use this in winit to define safe abstractions over NSApplication, NSWindow, NSView, NSResponer and so on.

A few Debug impls got worse from this change (since they now show the inheritance chain instead of just using description), but they weren't terribly important in the first place, and should be fixed properly at some point anyhow (e.g. NSArray's Debug impl should attempt to show the contents), so eh. NSString and NSMutableString still have proper implementations.

@madsmtm madsmtm added enhancement New feature or request A-framework Affects the framework crates and the translator for them labels Jul 5, 2022
@madsmtm madsmtm mentioned this pull request Jul 5, 2022
3 tasks
@madsmtm madsmtm force-pushed the extern-class-macro branch 3 times, most recently from a0a75ee to 18bae76 Compare July 5, 2022 23:27
@madsmtm madsmtm force-pushed the extern-class-macro branch from 18bae76 to c4a660f Compare July 5, 2022 23:41
@madsmtm madsmtm merged commit b1179f7 into master Jul 6, 2022
@madsmtm madsmtm deleted the extern-class-macro branch July 6, 2022 00:31
@madsmtm
Copy link
Owner Author

madsmtm commented Jul 20, 2022

See also prior art in fruity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant