Skip to content

Use local_inner_macros to remove the need to import 'sel_impl' when importing 'sel'#73

Closed
mehcode wants to merge 2 commits intoSSheldon:masterfrom
mehcode:feature/local-inner-macro
Closed

Use local_inner_macros to remove the need to import 'sel_impl' when importing 'sel'#73
mehcode wants to merge 2 commits intoSSheldon:masterfrom
mehcode:feature/local-inner-macro

Conversation

@mehcode
Copy link
Contributor

@mehcode mehcode commented Sep 23, 2018

Fixes #69. As far as I can tell the weird __objc__* macros are needed as the rewrite to $crate:: happens for all crates and there is no opt-out.

@SSheldon
Copy link
Owner

SSheldon commented Oct 7, 2018

I need to read up more on the macro changes, but... I'm really surprised that the proper solution is to redefine all of the std macros in every crate!?

@mehcode
Copy link
Contributor Author

mehcode commented Oct 7, 2018

This is if you want to remain compatible with old versions. You can just objc::sel_impl! inside the macros and it'll work but only as of when that's stable.

Note I'm not 100% here but it seems to be what others are doing.

@mehcode
Copy link
Contributor Author

mehcode commented Oct 22, 2018

@SSheldon rust-lang/rust#55268 (comment)

Seems the recommendation is to add a proxy macro on top of your macros that only calls internal macros that then can call std macros freely.

@richard-uk1
Copy link

(saw the link in the other issue) I think the idea is that this will only be required transitively - since you can update rust minor versions without breakage using 2015 edition, hopefully everyone will update and the $crate:: solution will be usable in the end.

@SSheldon
Copy link
Owner

SSheldon commented Apr 7, 2019

Thank you for your work here and helping me understand the macro changes! :)

At this point my plan is just to publish a version 0.3 of this crate which drops support for Rust 2015. I've merged #76 which switched the macros to use the $crate prefix, and in 39a6d52 the sel_impl! macro is actually removed entirely. So I believe this change is no longer necessary and I'll close out this PR.

@SSheldon SSheldon closed this Apr 7, 2019
@aloucks
Copy link

aloucks commented Jun 9, 2019

This is still an issue. When exporting a macro that calls send_msg!, the compiler fails to find the sel! macro unless the old style #[macro_use] extern crate objc is used.

@SSheldon
Copy link
Owner

Thanks for the reminder @aloucks, sorry for any confusion my comment caused. The issue is fixed in master, but I have not yet published a new version. The next version is going to be 0.3, the first breaking change to objc in 3 years, so I'm taking things a little slow to make sure it puts this crate in a good position for another 3 years ;)

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

Successfully merging this pull request may close these issues.

sel! can no longer be specifically macro_used in versions 0.2.3+

4 participants