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

Shall trees be Liftable if so in what way? #8200

Closed
scabug opened this issue Jan 29, 2014 · 3 comments
Closed

Shall trees be Liftable if so in what way? #8200

scabug opened this issue Jan 29, 2014 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jan 29, 2014

Let's have a look at a few examples of quote splicing:

val a1  = List(1, 2)
q”..$a1" // ==> q”1; 2"

val a2 = List(1, 2)
q”$a2"   // ==> q”scala.collection.immutable.List(1, 2)"

val b1 = List(q”a", q”b”)
q”..$b1” // ==> q”a; b"

val b2 = List(q”a", q”b”)
q”$b2" 
// now   ==> fails
// opt A ==> q”scala.collection.immutable.List(a, b)” 
// opt B ==> q"scala.collection.immutable.List(Ident(TermName("a")), Ident(TermName("b")))

Last example will work if we provide standard Liftable for trees which will essentially be an identity function (option A). This would be consistent with how lifting and splicing works in quasiquotes.

Another approach might be to lift trees as their reified equivalents (option B). But I don't expect this being needed by anyone apart from extremely advanced users and it would be quite surprising for everybody else. This will also be hard to implement considering that reification of trees as trees requires passing target universe somehow.

@scabug
Copy link
Author

@scabug scabug commented Jan 29, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8200?orig=1
Reporter: @densh
Affected Versions: 2.11.0-M8

@scabug
Copy link
Author

@scabug scabug commented Mar 24, 2014

@scabug
Copy link
Author

@scabug scabug commented Mar 24, 2014

@densh said:
Some discussion here: scalamacros/paradise#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants