Skip to content

extern_class! macro#188

Merged
madsmtm merged 3 commits into
masterfrom
extern-class-macro
Jul 6, 2022
Merged

extern_class! macro#188
madsmtm merged 3 commits into
masterfrom
extern-class-macro

Conversation

@madsmtm
Copy link
Copy Markdown
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
Copy Markdown
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