Given a case class
case class Foo(int: Int, str: String)
I would like this interface (or equivalent)
Foo.addField[Boolean]("bool").as("Foo2")
to automatically generate the code
case class Foo2(int: Int, str: String, bool: Boolean)
Is this possible using scala macros? I've had a look around and I can't find any decisive answer out there. Unfortunately I'm not too familiar with the API.
I'm not concerned about methods or anything like that, I just want a new named bucket the same as the previous one with one or more new fields.
EDIT: I'm pretty sure this blog post http://ravellaw.com/using-macro-annotations-to-reduce-boilerplate/ provides all the pieces of the jigsaw I need.