Skip to content

Remove Reflection StandardTypes #9815

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 Sep 17, 2020

All these can be replaced by a call to Type.of[XYZ].

We added them before we had a mechanism to get arbitrary types, now it became redundant.
These methods where more performant than the Type.of variant. We already oprimize primitive types for Type.of and could do it for other types when the need arises.

Migration
Replace defn.XYZType with Type.of[XYZ] (useful regex \bdefn\.(\w+)Type\b -> Type.of[$1]).

Now that the inspector provides the quote context, the interpreter can also use it
All these can be replaced by a call to `Type.of[XYZ]`.

We added them before we had a mechanism to get arbitrary types, now it became redundant.
These methods where more performant than the `Type.of` variant. We already oprimize primitive types for `Type.of` and could do it for other types when the need arises.
@nicolasstucki nicolasstucki force-pushed the remove-reflection-standard-types branch from 3d47e79 to 9f64cc1 Compare September 17, 2020 12:34
@nicolasstucki nicolasstucki marked this pull request as ready for review September 17, 2020 17:09
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

qctx.tasty.defn.DoubleType.seal.asInstanceOf[quoted.Type[Double]]
val qctx1 = quoteContextWithCompilerInterface(qctx)
qctx1.tasty.Definitions_DoubleType.seal.asInstanceOf[quoted.Type[Double]]

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do the same for Type.Int, etc as in Reflection.Type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That definition is not visible in the public API. It is used as an optimization of '[Int]. I'm looking for other ways to optimize it differently but it will take some time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, it makes sense.

@nicolasstucki nicolasstucki merged commit 04659be into scala:master Sep 17, 2020
@nicolasstucki nicolasstucki deleted the remove-reflection-standard-types branch September 17, 2020 19:36
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

3 participants