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

Support both JS/JVM and 2.10/2.11 via unmanagedSourceDirectories #2

Open
non opened this issue Jul 17, 2015 · 6 comments
Open

Support both JS/JVM and 2.10/2.11 via unmanagedSourceDirectories #2

non opened this issue Jul 17, 2015 · 6 comments

Comments

@non
Copy link
Owner

non commented Jul 17, 2015

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
@japgolly
Copy link

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.

@japgolly
Copy link

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

@non
Copy link
Owner Author

non commented Jul 17, 2015

@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.

@non
Copy link
Owner Author

non commented Jul 20, 2015

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.

@ghost
Copy link

ghost commented Jul 20, 2015

Also, discipline is not released, despite typelevel/discipline#13

@wheaties
Copy link

wheaties commented Dec 8, 2015

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.

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

No branches or pull requests

3 participants