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

Improve macro hygiene #1633

Closed
5 tasks done
siku2 opened this issue Oct 28, 2020 · 1 comment · Fixed by #2585
Closed
5 tasks done

Improve macro hygiene #1633

siku2 opened this issue Oct 28, 2020 · 1 comment · Fixed by #2585
Assignees
Labels
A-yew-macro Area: The yew-macro crate macro Issues relating to our procedural or declarative macros
Milestone

Comments

@siku2
Copy link
Member

siku2 commented Oct 28, 2020

I keep running into places where Yew's macros aren't as hygienic as they could be. Especially now that the MSRV is 1.45.0 (which brings a few more macro features like mixed_site) it's time to do a full sweep and solve all the remaining issues:

  • Ensure all trait methods are invoked unambiguously
  • Use fully qualified paths everywhere (including primitives from ::std::primitive)
  • Use a configurable yew crate parameter
  • Use Span::mixed_site() for macro variables so they aren't available in user code
  • Test with #![no_implicit_prelude]
    • html_macro
    • properties derive
    • props macro
    • classes macro
    • function component derive
  • Add #[doc(hidden)] to all structs (especially in derive_props)
@siku2 siku2 added the macro Issues relating to our procedural or declarative macros label Oct 28, 2020
@siku2 siku2 added this to the v0.19 milestone Oct 28, 2020
@siku2 siku2 self-assigned this Oct 28, 2020
@mc1098
Copy link
Contributor

mc1098 commented Sep 13, 2021

Use a configurable yew crate parameter

Why not? :)

Use Span::mixed_site() for macro variables so they aren't available in user code

When I've tried to tackle this I find that either I have to lose out on a useful span for error messages - or jump through some hoops to still use a variable from one quote block to another. Not sure if I'm missing something here :) thought I'd mention why I have seemingly stopped chipping away at this issue 😅

@mc1098 mc1098 added the A-yew-macro Area: The yew-macro crate label Sep 20, 2021
@ranile ranile mentioned this issue Apr 6, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew-macro Area: The yew-macro crate macro Issues relating to our procedural or declarative macros
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants