Please log in to watch this conference skillscast.
But not everything is rosy. Case classes come with restrictions, some of which are essential, some not. And they have some characteristics, again some essential, some not, which are not always entirely appropriate or desirable. This has led to the often expressed desire to be able to pick and choose or otherwise customize case class features: case classes a la carte.
Unfortunately this has seemed to require changes to the Scala compiler which for various reasons have been perceived to be too difficult or too risky to attempt. The arrival of macros, macro annotations in particular, briefly raised the prospect that case classes a la carte might again be on the table. But macro annotations are not yet available in a production ready Scala compiler and might never be.
But all is not lost. Generating the scaffolding for case classes is a generic programming problem, and the fact that one solution to that problem is hard coded into scalac doesn't preclude other approaches from being applied. To that end I will demonstrate one way of tackling this problem using the generic programming library shapeless, and show some of the exciting new possibilities this opens up ... crucially in the context of current (ie. 2.10.x and 2.11.x) Scala compilers.
YOU MAY ALSO LIKE: