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

Rename reflect/reify and make them plain methods #5474

Merged

Conversation

nicolasstucki
Copy link
Contributor

Remove implicit conversion of the extension methods from the API

@allanrenucci
Copy link
Contributor

Is that what we decided? I thought it was:

(exp: Expr[T]).toTree
(tpe: Type[T]).toTypeTree
(tree: Tree).toExpr[T]

An then replace the extension method toExpr on Any by a normal method

@nicolasstucki
Copy link
Contributor Author

Didn't we said that that was not good because both methods would still be called toExpr?

@odersky
Copy link
Contributor

odersky commented Nov 20, 2018

I believe the .toExpr on Any is actually the more important of the two so I would leave it.

But it would be good to have extension methods for converting between Expr[T] and Tree. What about this one:

def (e: Expr[T]) unseal[T]: Tree
def (t: Tree) seal[T]: Expr[T]

@smarter
Copy link
Member

smarter commented Nov 20, 2018

I believe the .toExpr on Any is actually the more important of the two so I would leave it.

Is it really ? It means that every time you press "." in the IDE it will show up, even though 99% it won't be what you're looking for. Not to mention that this means you'll have a hard time calling it on any class that defines its own toExpr.

Didn't we said that that was not good because both methods would still be called toExpr?

No, because if it's not an extension method you give it another name, like liftToExpr

@nicolasstucki
Copy link
Contributor Author

Is it really ? It means that every time you press "." in the IDE it will show up, even though 99% it won't be what you're looking for. Not to mention that this means you'll have a hard time calling it on any class that defines its own toExpr.

Only if you imported scala.quoted._

@nicolasstucki
Copy link
Contributor Author

As discussed in the meeting, we will use

def (e: Expr[T]) unseal[T]: Tree
def (t: Tree) seal[T]: Expr[T]

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

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

Can you update the minitest in the community build as well

docs/docs/reference/tasty-reflect.md Show resolved Hide resolved
@nicolasstucki
Copy link
Contributor Author

I fixed minitest in the community build and it will not be affected further by this change.

@nicolasstucki nicolasstucki merged commit 11a9a78 into scala:master Nov 27, 2018
@nicolasstucki nicolasstucki deleted the rename-tasty-to-quote-methods branch November 27, 2018 09:15
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.

None yet

4 participants