Closed Andrei-Pozolotin closed 9 years ago
It would be nice, indeed, but then all macro annotation developers would have to import that MacroAnnotation
from somewhere. That somewhere would probably be a library accompanying the macro paradise plugin.
While having a companion library is not impossible (in fact, that's what we do to support quasiquotes in paradise 2.10), it creates extra hassle for the users, so we have to weigh that against the benefits that we're receiving. In my opinion, the extra bit of type safety isn't worth it. Wdyt?
I see your point. But from my macro newbie experience, I was not clear from your docs http://docs.scala-lang.org/overviews/macros/annotations.html that "macroTransform" is a magic name, and was a source of confusion for me.
Can you make this annotation part of standard scala.reflect.runtime
name space?
@Andrei-Pozolotin I've updated the docs: https://github.com/scala/scala.github.com/pull/403. Do you find the wording reasonable?
As for scala.reflect.runtime
, I think that Typesafe Scala team will be not very enthusiastic about putting something that's only useful for a non-standard compiler plugin into standard distribution. Also, there are binary compatibility constraints which mean that the earliest we can do that is Scala 2.12.0.
1) re: https://github.com/scala/scala.github.com/pull/403 yes, that clarifies it, thank you.
2) what about the other "magic name" annottees
; have not run into that yet, but
https://github.com/scalamacros/paradise/blob/2.11.5/plugin/src/main/scala/org/scalamacros/paradise/reflect/StdNames.scala#L9
2) Wow, looks like it's also hardcoded, but I completely forgot about this. Luckily, macro paradise will let you know if the signature is wrong.
oh, great. :-) probably could mention in the docs if you are still in the mood. feel free to close this, thank you.
it is not clear why using "magic name"
macroTransform
is the way to go: https://github.com/scalamacros/paradise/blob/2.11.5/plugin/src/main/scala/org/scalamacros/paradise/reflect/StdNames.scala#L10would it be better ("type-safe"? :-)) to have explicit macro annotation contract instead: