Skip to content

Remove ambiguities from TASTy reflect interface #6191

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

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Mar 29, 2019

@nicolasstucki nicolasstucki self-assigned this Mar 29, 2019
@nicolasstucki nicolasstucki changed the title Rename TypeTree.{Ident|Select} to TypeTree.{TypeIdent|TypeSelect} Remove ambiguities from TASTy reflect interface Mar 29, 2019
@nicolasstucki nicolasstucki marked this pull request as ready for review March 29, 2019 10:17
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

There is a worry about the two confliciting goals:

  • consistency of naming between Type and TypeTree
  • reduce name conflicts

tpd.cpy.RefinedTypeTree(original)(tpt, refinements)

type TypeTree_Applied = tpd.AppliedTypeTree
type Applied = tpd.AppliedTypeTree
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be TypeApplied?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do this renaming after #6193 for simplicity

* | +- ByName
* | +- LambdaTypeTree
* | +- TypeBind
* | +- TypeBlock
Copy link
Contributor

Choose a reason for hiding this comment

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

This refactoring reminds me of a disagreement among @xeno-by @odersky @olafurpg and me about whether type trees and types should be the same.

Now opinions seem to converge that they should not be the same, as it's implemented in Tasty Reflect. However, I think one issue left unaddressed: the confusion to meta programmers why there are seemingly overlapping Types and TypeTrees and usability problems evidenced by this PR.

To address the usability issue, I propose to just have one abstract type TypeTree (which could be used for positions) and remove all APIs to extract or construct TypeTree. Instead, meta-programmers should always work with Types, which is more reliable, as we do in the compiler.

Just a thought for discussion, no need to address in this PR.


/** Type tree representing a type refinement */
type TypeTree_Refined <: TypeTree
type Refined <: TypeTree
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 called Refinement in Type, do we need some consistency here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do this renaming after #6193 for simplicity

@nicolasstucki nicolasstucki merged commit 4705df2 into scala:master Mar 29, 2019
@ghost ghost removed the stat:needs review label Mar 29, 2019
@nicolasstucki nicolasstucki deleted the disambiguate-ident-and-select branch March 29, 2019 12:08
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