Skip to content

Add tasty.reflect.Kernel #5990

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

Merged
merged 17 commits into from
Mar 7, 2019
Merged

Conversation

nicolasstucki
Copy link
Contributor

The idea is to move all logic from the TASTy reflect API that needs to be implemented by the compiler to the kernel. This will allow us to decouple the user-facing API from the compiler implementation.

@nicolasstucki nicolasstucki self-assigned this Feb 27, 2019
@nicolasstucki nicolasstucki force-pushed the extract-tasty-kernel branch 16 times, most recently from 3663724 to f127535 Compare March 4, 2019 09:49
@nicolasstucki nicolasstucki requested a review from liufengyun March 4, 2019 15:38
@nicolasstucki nicolasstucki force-pushed the extract-tasty-kernel branch 7 times, most recently from be6396e to 8f04ba5 Compare March 5, 2019 15:31
@nicolasstucki nicolasstucki marked this pull request as ready for review March 5, 2019 15:56
@nicolasstucki nicolasstucki removed their assignment Mar 5, 2019
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Well done 👍

This is a nice step towards the split between user-facing contracts & compiler-facing contracts. Some comments for further improvements (for later PRs, this PR is already huge):

  1. Better naming scheme. Names are always a headache for programming, currently the method name def ClassSymbol_companionClass is not nice.

  2. Kernel is now the interface between macro system & compiler, thus safe construction of trees should not be a design goal for Kernel, as the APIs are not used by programmers . A worthwhile design goal would be to minimize the contract & defend against compiler changes. For example, Kernel does not need to define the same set of abstract types as Core. In terms of minimizing interface, currently it's not ideal:

  def Tree_pos(self: Tree)(implicit ctx: Context): Position
  def Term_pos(self: Term)(implicit ctx: Context): Position
  def Pattern_pos(self: Pattern)(implicit ctx: Context): Position
  def TypeTree_pos(self: TypeTree)(implicit ctx: Context): Position
  def Id_pos(self: Id)(implicit ctx: Context): Position

In the design of Kernel, can we assume that Scala2 is going to implement it as well some day? That may help with the design.

@@ -116,48 +116,50 @@ package scala.tasty.reflect
*/
trait Core {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to find another name for Core, to avoid conflicts with Kernel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about ReflectionTypes?

@nicolasstucki nicolasstucki force-pushed the extract-tasty-kernel branch from fa232e0 to 80028d9 Compare March 6, 2019 11:13
@nicolasstucki
Copy link
Contributor Author

Rebased

@liufengyun liufengyun merged commit 4447d83 into scala:master Mar 7, 2019
@liufengyun liufengyun deleted the extract-tasty-kernel branch March 7, 2019 12:54
@liufengyun
Copy link
Contributor

This PR reduces compile time for the Dotty project.

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

Successfully merging this pull request may close these issues.

2 participants