Created
January 2, 2012 19:29
-
-
Save xeno-by/1551797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Certain types of quasiquotes can have dynamic number of bound varables (example is shown here: | |
https://gist.github.com/1548942, a code pattern with a single splice gets transformed into | |
a pattern with two bound variables), so just requiring a quasiquote provider to expose unapply isn't enough. | |
Having unapplySeq will work, but won't help us with allocating slots for the case of | |
pattern matching used to declare variables: val c"$x + $y" = c"2 + 2". | |
Also, when generating a pattern, quasiquote provider might need to access the guard as well | |
(see https://gist.github.com/1548942 for an example). This doesn't directly fit into the model of | |
macro-driven quasiquote expansion. We either give the q/q provider access to | |
the entire CaseDef (including the body) or hinder it by disallowing to customize guards. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment