-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add argless #annotations
overload
#9326
Add argless #annotations
overload
#9326
Conversation
I'm not convinced that I'm not convinced that getting all the annotations together is useful. Wouldn't you need to know the type to know what properties and semantics give to the annotation? If so, why the methods that return only the annotation of a given type is not enough? You will query based on the type you want to give semantics to. I've expressed this before, that querying annotation should have a design cycle regarding how the type hierarchy plays along. Are annotations attached to descendant types? Can we query for exact on inherited annotations? C# reflection API is a good source for inspiration here. Without discussing those things I think that all these reflection methods are experimental. I thought the issue was about making the annotation information available on runtime. |
This was more so to return the name of the annotation (i.e. whats in between the
The idea behind #9322 (and by extension this PR) was to provide a simple workaround for the lack of runtime reflection by exposing the data required to get a similar effect. For example, building out a hash (at compile time) of the annotations and data within the annotations, then using this hash at runtime; can look at my example in the original issue for example code.
Annotations in general could use some love. There are plenty of optimizations, improvements, and such that could make them even more useful. However, I think that can happen independently of this PR. The API for |
7906615
to
330778f
Compare
Bump. |
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Bump again 🙈. |
Don't suppose I can get another review on this? |
But it's not clear that this is what we want, so first we must discuss this instead of reviewing this PR. But it's unlikely this will happen before 1.0. And after 1.0 it's not a breaking change, so... |
Adds: * `Annotation#name` * #9326 converts the name to a `MacroId` on behalf of the user. This PR returns the `Path` directly (like `Generic`). * `{Case,When}#exhaustive?` * `Call#global?` * `Def#{abstract?,free_vars}`
#all_annotations
macro method
I personally would find this method useful, but if there are other higher level discussions happening related to this (e.g. maybe #9802) feel free to close. |
Support `#annotations` on `Arg`
#all_annotations
macro method#annotations
overload
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Resolves #9322. Was pretty simple so just went and did it.