imp
imp copied to clipboard
Support both JS/JVM and 2.10/2.11 via unmanagedSourceDirectories
While adding scala.js support, I was forced to remove the src/main/scala_2.10
and src/main/scala_2.11
directories. Previously we used:
unmanagedSourceDirectories in Compile +=
(sourceDirectory in Compile).value / s"scala_${scalaBinaryVersion.value}"
This didn't work with scala.js, so I was forced to write macros that worked in both 2.10 and 2.11. However, this makes the macros under 2.11 slightly less powerful.
Old code (more powerful):
def summon[Ev](c: Context)(ev: c.Tree): c.Tree = ev
New code (2.10 compatible):
def summon[Ev](c: Context)(ev: c.Expr[Ev]): c.Expr[Ev] = ev
Why or in what way is the new version less powerful? I'm fairly new to macros and looking at the two signatures, I don't understand the difference.
Also, if you haven't read the following link, I think it would be helpful wrt this issue:
http://www.scala-js.org/api/sbt-scalajs/0.6.4/#org.scalajs.sbtplugin.cross.CrossProject
@japgolly My understanding is that with the current macro if you "summon" an X
you get something back of exactly that type. With the older code, the return type could possibly be refined to something more specific.
This additional specificity isn't something that I need in most cases but my understanding is that libraries like Shapeless do really benefit from it.
Trying to cross build 2.10 and 2.11 here may also run aground on https://github.com/InTheNow/sbt-scalajs/issues/19 now that we are publishing for scala.js too.
Also, discipline is not released, despite https://github.com/typelevel/discipline/pull/13
Now that macro-compat is out, would you be looking to support the 2.11 more powerful and 2.10 less powerful at the same time? I'm asking because I'm very interested in seeing what this project could do for things we're working on at work.