Skip to content

Define the macro API for generating metadata annotations on declarations #1931

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

Closed
munificent opened this issue Oct 21, 2021 · 2 comments
Closed
Assignees
Labels
static-metaprogramming Issues related to static metaprogramming

Comments

@munificent
Copy link
Member

The builder API currently doesn't give you a way to add metadata annotations to declarations created by macros. There's a TODO in the proposal to allow that.

@jakemac53
Copy link
Contributor

jakemac53 commented Jul 11, 2023

There are two aspects to this:

The ability to add annotations to existing declarations

As I have dug into this, I think it is in direct conflict with the ability to introspect on the annotations on a given declaration, and the general principal that we want to always provide "complete" results when questions are asked of a program. Multiple macros, even in the same phase, might get different answers for what the annotations are on a given declaration. At a minimum this implies ordering constraints within phase 1 and phase 3 which don't otherwise exist currently (all macros in those phases can run simultaneously today).

I also think it is much more useful to be able to introspect on annotations, compared to adding new annotations on existing declarations. So I am inclined to just not allow adding annotations to existing declarations for now.

The ability to add annotations to new declarations.

This is already possible. Whenever adding a new declaration you provide the entire thing and are allowed to include both documentation comments and metadata annotations.

@jakemac53
Copy link
Contributor

jakemac53 commented Jul 12, 2023

I am going to put this into the backlog (specifically, adding annotations to existing declarations) to look at for future releases given the concerns I have and lack of current compelling reasons to support it.

jakemac53 added a commit that referenced this issue Jul 13, 2023
lrhn pushed a commit that referenced this issue Jul 21, 2023
@davidmorgan davidmorgan closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
static-metaprogramming Issues related to static metaprogramming
Projects
Development

No branches or pull requests

3 participants