This is a follow-up now that Scala 2.8.0 beta is out to this question:
The new technique is to copy a case class, e.g.
case class Person(name:String, email:String)
val bob = Person("Bob", "[email protected]")
val jill = bob.copy(name = "Jill")
This works great, except for the fact that Scala seems to limit me to 22 (?) properties in a case class. That might seem like a lot, it's insufficient in my case.
With 23, I get: "error: type Function23 is not a member of package scala". I could possibly define my own Function23, etc., but I don't know the implications of that.
So now I'm back to square one. I need to use public vars, which I'm trying to avoid, or create a 26+ parameter constructor and a paired copy method. Ick.
22 seems like a rather arbitrary limit here. Is there a way around this?
This is for data import, which looks something like this:
new CatalogImportRecord() {
override val List(SVal(vendorSku), SVal(title), IVal(issues),
_, // YToMVal(termMonths),
DVal(sellPrice), DVal(buyPrice), DVal(retailPrice), NotesVal(allowsNew, allowsRenewals),
_) //DateValMdy(lastUpdated))
= fields
You can see I commented out unused extractions to reduce the number of fields.
Maybe there's a better way to do this. I find this extraction technique a bit rigid, but that might be for the best.