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

Macro compilation issues with Scala 2.13 #118

Open
loicdescotte opened this issue Sep 20, 2018 · 6 comments
Open

Macro compilation issues with Scala 2.13 #118

loicdescotte opened this issue Sep 20, 2018 · 6 comments
Milestone

Comments

@loicdescotte
Copy link
Contributor

See #117

@loicdescotte loicdescotte added this to the 4.0 milestone May 6, 2019
@denisftw
Copy link
Contributor

Hey @loicdescotte

Do I understand correctly that everything can be compiled with Scala 2.13 except for macro-related things like HList and Show? It seems that Macro Paradise is becoming abandoned, so it's probably better to migrate to something else.

From you comment here I though that Scala 2.13 is supposed to make things easier or I am mistaken?

@loicdescotte
Copy link
Contributor Author

Hi @denisftw,

Indeed everything except macros would work with 2.13.
The issue is that scala meta macros are not supported anymore so we sould rewrite this macros using scala reflect. It does not only impact Show and HList but mot of our features : https://github.com/scala-hamsters/hamsters/tree/master/metas/shared/src/main/scala/io/github/hamsters

@denisftw
Copy link
Contributor

Hi @loicdescotte ,

This is indeed more, but it still looks doable (although I have zero experience in writing macros and no authority :)).

If I understand correctly, macro annotations were merged into the Scala compiler (scala/scala#6606) and should be available using a flag. However, I'm not sure it's possible to have this flag and keep old Scala versions supported at the same time. Slinky does it, but the structure looks simpler.

Do you have a branch somewhere that already has desired build.sbt file with satisfactory dependencies and maybe an example of one converted annotation? I guess having something like this would speed things.

@loicdescotte
Copy link
Contributor Author

Hi @denisftw,
The problem is not with macro paradise but with Scala meta that does not exists for scala 2.13.
The solution is to re-write the macros with scala reflect (I think it has been done on Cats for example : typelevel/cats-tagless#6), or to write manually all the methods with different arity (2, 3, 4, ... 22 parameters) .
It may be better not to rely on any macro at all since neither scala reflect nor scala meta will be supported in Scala 3.x.

@loicdescotte
Copy link
Contributor Author

@denisftw I've stared to extract modules compatible with Scala 2.13 here : https://github.com/scala-hamsters

for example monad transformers : https://github.com/scala-hamsters/monad-transformers

@denisftw
Copy link
Contributor

@loicdescotte Awesome, thanks!

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

No branches or pull requests

2 participants