Skip to content

Remove quoted name splices #8693

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 1 commit into from
Apr 8, 2020

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 8, 2020

The current encoding of name splices is quite ad-hoc and intrusive. It changes the meaning
of a name that starts with $ which does not align with other kinds of splices. It also does
not align with the names that may be shown by Expr.show.

Based on #8692.

@nicolasstucki nicolasstucki requested a review from liufengyun April 8, 2020 07:54
@nicolasstucki nicolasstucki self-assigned this Apr 8, 2020
@nicolasstucki
Copy link
Contributor Author

Additionally, this feature does not provide any semantic meaning to the names hence it does not align with the quotes and splices abstractions.

It is always possible to recover this name using reflection.

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.

Nice refactoring 👍

def rhsEnv = summon[Env] + (scrutinee.symbol -> pattern.symbol)
bindMatch && tpt1 =?= tpt2 && treeOptMatches(rhs1, rhs2)(using summon[Context], rhsEnv)
tpt1 =?= tpt2 && treeOptMatches(rhs1, rhs2)(using summon[Context], rhsEnv)
Copy link
Contributor

Choose a reason for hiding this comment

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

The pattern matching on definitions up to alpha-conversion 👍

@nicolasstucki nicolasstucki force-pushed the remove-name-patterns branch from f495ef1 to 95eeaef Compare April 8, 2020 11:50
@nicolasstucki
Copy link
Contributor Author

We need to rebootstrap the compiler to have #8692 in the reference compiler.

@smarter
Copy link
Member

smarter commented Apr 8, 2020

We need to rebootstrap the compiler to have #8692 in the reference compiler.

Alternatively, you could leave the definitions needed by the non-bootstrapped compiler in the library for now, or move them to library/src-non-bootstrapped/

@nicolasstucki nicolasstucki force-pushed the remove-name-patterns branch from 95eeaef to 1d2ac5c Compare April 8, 2020 12:07
The current encoding of name splices is quite ad-hoc and intrusive. It changes the meaning
of a name that starts with `$` which does not align with other kinds of splices. It also does
not align with the names that may be shown by `Expr.show`.
@nicolasstucki nicolasstucki force-pushed the remove-name-patterns branch from 1d2ac5c to 5c40b96 Compare April 8, 2020 12:26
@nicolasstucki nicolasstucki marked this pull request as ready for review April 8, 2020 14:43
@nicolasstucki
Copy link
Contributor Author

I kept the annotation for now as it is internal and will not change anything. I left a TODO to remove it when we rebootstrap.

@nicolasstucki nicolasstucki merged commit 44b8353 into scala:master Apr 8, 2020
@nicolasstucki nicolasstucki deleted the remove-name-patterns branch April 8, 2020 14:46
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