scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.87k stars 1.06k forks source link

document migration of macros that require fresh names #12960

Open cchantep opened 3 years ago

cchantep commented 3 years ago

Scala 2 Macro freshName has no equivalent in new meta-programming API.

bishabosha commented 3 years ago

All names you give will be automatically made fresh in scope, do you have an example where something breaks because of this expectation?

cchantep commented 3 years ago

Then it's important to clearly state that point in the migration guide. I haven't personally seen anything about (neither in the source quote).

nicolasstucki commented 3 years ago

Technically we do not support the fresh name concept as this is part of syntactic macros that scala 3 does not support (such as in re-typethinking).

We only support semantic macros where names are themself semantic (i.e. symbol). These names do not need to be refreshed as conflicts are not possible. In Scala 3 once you created a name for a definition, it is guaranteed to not have conflicts. Internally there are some renaming that happens for local variables to make it possible to distinguish different names.

We need a migration example with some code that requires re-typechecking and fresh names.

ValeriePe commented 2 years ago

This issue was picked for the Issue Spree 18 of July 5th which takes place in a week from now. @EstebanMarin @anatoliykmetyuk will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

ValeriePe commented 2 years ago

This issue was picked for the Issue Spree n° 19 of August 16th which takes place in a week from now. @tgodzik @gagandeepkalra @jackcviers will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

tgodzik commented 2 years ago

I might not be able to join unfortunately today. :sweat: I am curious though what was the result of the previous spree @anatoliykmetyuk ?

EstebanMarin commented 2 years ago

Hello everyone. @tgodzik @anatoliykmetyuk In the previous meetings we had on this, the idea was simple. Is to start a scala 3 seed: https://index.scala-lang.org/regadas/scala-seed and ensure the code of the macros https://docs.scala-lang.org/scala3/guides/macros/ tutorial runs. Once that is checked then the next step is to then fill the missing parts of the documentation https://docs.scala-lang.org/scala3/guides/macros/compiletime.html => in the values, testing, assertions

cchantep commented 2 years ago

The tutorial doesn't indicate that unlike Scala 2 macro there is no need to do anything special to have fresh term name, so that's different issue.