Hey! I hope you have a good time.
recently I've noticed that Scala has Macros with the ability to manipulate AST just like Nim.
but surprisingly they don't advertising it ( I can't see much tutorials/projects about it ) which is opposite in Nim.
If you have background in programming with Scala, could you please explain how does a macro in Scala and Nim differ AND why aren't they more popular in Scala?
thanks
iirc Scala 3 lacks them entirely.
https://docs.scala-lang.org/scala3/guides/macros/macros.html https://eed3si9n.com/intro-to-scala-3-macros/
So they did add them again. Interesting, I remember Odersky saying that he considers to leave them out.
I stand corrected.
You can do both:
macro foo(ast: untyped) = ...
macro foo(ast: typed) = ...
If you have background in programming with Scala, could you please explain how does a macro in Scala and Nim differ AND why aren't they more popular in Scala?
I suspect it may be because the language is in a "Python 2 -> 3" bifurcation moment.
It has been a long time since I've personally programmed Scala, so doing a cursory glance (also take this with a grain of salt):