On Sun, Nov 4, 2012 at 6:26 PM, Eric Christiansen
> Hey, it's a bit unclear to me, just having skimmed the docs, what Treehugger
> can and can't do:
> 1) Can Treehugger evaluate the trees it creates? If so, it should be example
> code, augmenting the code here.
No, treehugger doesn't evaluate the tree. The evaluation should be
handled by Scala, or other libraries.
> If not, it's confusing to say
> "treehugger.scala is a library to code Scala programmatically", because that
> makes me think it's a metaprogramming library.
It's a code generation library. If someone wants to call that staging
or metaprogramming, it is, but treehugger is not macro.
> 2) Does Treehugger generate code dynamically or at compile-time? Eg, could I
> use it to rewrite my code before it's compiled?
At the moment treehugger supports only runtime generation, which you
can integrate into the build process using sbt.
If you want AST transformation of your Scala code, that's what Scala
2.10's macro does. I have an experimental subproject of treehugger
called trehugger-bridge. Using that I was able to port Scala Macro's
"getting started" example to treehugger:
There I convert Scalac tree given by macro to treehugger tree,
manipulate it, and then convert it back to Scalac tree. It seems like
too much work to implement complete conversion, so treehugger-bridge
will remain experimental until I need it myself, or someone else want
to give it a shot.
Hope this helps.