-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Simplify CompilerInterface abstraction #10189
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
Simplify CompilerInterface abstraction #10189
Conversation
14c3718 to
5cc810e
Compare
liufengyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.internal.quoted.CompilerInterface: | ||
|
|
||
| object reflect extends scala.tasty.Reflection, scala.internal.tasty.CompilerInterface: | ||
| object reflect extends scala.tasty.Reflection: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three concepts here:
- CompilerInterface
- Reflection
- QuoteContext
The responsibility for QuoteContext is relatively clear, it's the facade and it mainly holds API for Type[T] and Expr[T].
It seems there is some overlapping of responsibilities between Reflection and CompilerInterface:
CompilerInterfaceis a contract with the compiler, not the API for meta-programmersReflectionis both the contract with the compiler, and the API for meta-programmers
To continue the refactoring in #9818, it would be nice to make the responsibility of each interface clear and disjoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that this PR also removed the overlapping between Reflection and CompilerInterface as now the CompilerInterface only cares about Expr and Type, but nothing within Reflection.
I will still try to make the internal interaction with CompilerInterface simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that this PR also removed the overlapping between
ReflectionandCompilerInterfaceas now theCompilerInterfaceonly cares aboutExprandType, but nothing withinReflection.
So rename CompilerInterface to QuoteInterface might make things more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make it clearer.
Make the abstraction be directly on Expr and Type as those are the operations that they expose.