Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Support for macro annotations #278

Closed
bertlebee opened this issue Jan 12, 2022 · 2 comments
Closed

Support for macro annotations #278

bertlebee opened this issue Jan 12, 2022 · 2 comments

Comments

@bertlebee
Copy link

Very surprised that nobody has raised this before, so figured I'd better.

Currently, macro annotations are not supported in scala 3.

Some of the functionality can be achieved with typeclass derivation and/or Selectable machinery, but it's amazingly awkward, suffers from the limitations of Selectable, and anything that's generated doesn't make it to the class definition.

Something that integrates nicely/reuses with both the existing quoting/splicing and lower level reflect API would be ideal, but it'd be great to be able to generate any code that you can write (as part of compilation, so people are unable to modify the generated code).

Related:

Scala 2 macro annotation docs:
https://docs.scala-lang.org/overviews/macros/annotations.html

An old blog post that mentioned it could be done (I just assumed it hadn't been implemented yet)
https://www.scala-lang.org/blog/2018/04/30/in-a-nutshell.html

An example of a 2.x use case:
https://zio.dev/version-1.x/howto/use-zio-macros/

@kitlangton
Copy link

This would be incredible. By far the biggest obstacle when migrating to Scala 3. Here's a related issue: scala/scala3#14891 (comment)

@ckipp01
Copy link
Contributor

ckipp01 commented Jun 5, 2023

I believe we can consider this implemented via scala/scala3#16392 and scala/scala3#16454, so I'll go ahead and close. If there are further ideas please do open a discussion here.

@ckipp01 ckipp01 closed this as completed Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants