scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

document migration of macros that require fresh names

Open cchantep opened this issue 3 years ago • 5 comments

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

cchantep avatar Jun 27 '21 20:06 cchantep

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

bishabosha avatar Jun 27 '21 20:06 bishabosha

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

cchantep avatar Jun 28 '21 07:06 cchantep

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.

nicolasstucki avatar Jul 26 '21 10:07 nicolasstucki

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 avatar Jun 27 '22 08:06 ValeriePe

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.

ValeriePe avatar Aug 08 '22 11:08 ValeriePe

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

tgodzik avatar Aug 16 '22 07:08 tgodzik

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

EstebanMarin avatar Aug 16 '22 14:08 EstebanMarin

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.

cchantep avatar Aug 16 '22 15:08 cchantep