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

Unify metadata handling in reflection API #8222

Closed
scabug opened this issue Feb 1, 2014 · 3 comments
Closed

Unify metadata handling in reflection API #8222

scabug opened this issue Feb 1, 2014 · 3 comments
Milestone

Comments

@scabug
Copy link

scabug commented Feb 1, 2014

It seems like it's high time to generalize and unify our approach to various pieces of metadata under annotations.

On the one hand, we have flags (#6267) and DocDefs (#7993) that can be represented as annotations. They can also be joined by visibility modifiers, associatedFile and maybe even attachments, giving us uniform way to store, query and update metadata on reflection artifacts.

On the other hand, it seems that we can drastically simplify our annotations by replacing them with plain trees. We have to decide on the exact shape of those trees (at the moment, I like Denys's idea of translating @foo(bar, baz) into a typechecked invocation of foo(bar, baz) where foo can be whatever's in scope rather than new foo(bar, baz) where foo can only be a subclass of Annotation like it's done now) and on Java compatibility policy, but once we do that, everything is going to become so much simpler: https://groups.google.com/forum/#!topic/scala-internals/8v2UL-LR9yY

@scabug
Copy link
Author

scabug commented Feb 1, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8222?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0, 2.11.0
See #6267, #8259, #4788, #6991, #7041, #7993, #8250

@scabug
Copy link
Author

scabug commented Feb 7, 2014

@xeno-by said (edited on Feb 7, 2014 4:36:12 PM UTC):
It looks like positions can also be logically viewed as annotations, enabling something like this:

val pos: Position = ...
q"@$pos def foo = bar"

Also see #8250.

@SethTisue
Copy link
Member

reflection API in Scala 2 is pretty frozen these days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants