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

Make extraction of repetitive code patterns easier in quasiquotes #8164

Closed
scabug opened this issue Jan 20, 2014 · 2 comments
Closed

Make extraction of repetitive code patterns easier in quasiquotes #8164

scabug opened this issue Jan 20, 2014 · 2 comments
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jan 20, 2014

It'd be great to have support for matching over repetitive patterns in trees:

val q"def foo(..{$names: $tpes = $defaults})" = q"def foo(x: X, y: Y = Y(0))"
// names    == List(TermName("x"), TermName("y"))
// tpes     == List(tq"X", tq"Y")
// defaults == List(q"", q"Y(0)")

Currently one has to write:

val q"def foo(..$params)" = q"def foo(x: X, y: Y = Y(0))"
val names    = params.map { case q"$_ val $name: $_   = $_"       => name    }
val tpes     = params.map { case q"$_ val $_   : $tpe = $_"       => tpe     }    
val defaults = params.map { case q"$_ val $_   : $_   = $default" => default }
@scabug
Copy link
Author

@scabug scabug commented Jan 20, 2014

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@SethTisue
Copy link
Member

@SethTisue SethTisue commented Mar 1, 2018

closing all quasiquotes tickets; see #10755

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

No branches or pull requests

3 participants