I'd really like to use case classes' copy feature in my project, but unfortunately I also need inheritance, which doesn't work well with case classes.
So, I'm wondering if it's possible to write a macro which will generate a method for creating copy-with-changes object for an arbitrary class. What stops me there at the moment is the fact that AFAIK macros don't support named parameters. Has anyone found a way around that or, alternatively, can suggest other way for easy creating of copies which use inheritance?
Asked
Active
Viewed 338 times
0

Lukasz Gieron
- 276
- 2
- 12
2 Answers
2
That will be possible with type macros and/or annotation macros. The current macros do not support this.
Do look at lenses work, though. There's quite a few macro-based versions around, such as Shapeless.

Daniel C. Sobral
- 295,120
- 86
- 501
- 681
0
You could also take a look at https://github.com/dicarlo2/ScalaEquals

Eugene Burmako
- 13,028
- 1
- 46
- 59