Question

I understand that dynamic languages (Ruby, Clojure, Groovy) provide metaprogramming support, but how about Scala?

Is there a use case for metaprogramming in Scala for DSL creation?

Caveat - I don't fully understand metaprogramming, but consider it potentially helpful for handling creating a new DSL grammar/rule at run-time (which may/may not be correct).

I've read this useful question, but I'm more interested in why(if there is one) to use metaprogramming in Scala.

Was it helpful?

Solution

Metaprogramming in Scala now mostly revolves around Scala macros, a relatively fresh and still experimental compile-time metaprogramming facility.

Despite their relative immaturity and complexity (they're not easy to write), macros are already used in multitude of projects, since they look very promising for many purposes. See for example this video: What Are Macros Good For

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top