case-class

Scala traits / cake pattern vs case classes

In my web application authorized user has at least 4 "facets": http session related data, persistent data, facebook data, runtime business data. I've decided to go with case class composition instead of traits for at least two reasons: traits mixing can cause name clashes i want the free case class goodies like pattern matching and co...

Cleaner way to update nested structures

Say I have got following two case classes: case class Address(street: String, city: String, state: String, zipCode: Int) case class Person(firstName: String, lastName: String, address: Address) and the following instance of Person class: val raj = Person("Raj", "Shekhar", Address("M Gandhi Marg", ...

Does `productElement(i)` on a case-class use reflection?

Considering the following Scala snippet: case class Foo(v1: String, v2: Int, v3: Any) def inspect(p: Product) = (0 until p.productArity).foreach(i => println(p.productElement(i))) inspect(Foo("Moin", 77, null)) Does the invocation of inspect() here means that reflection is used (in whatever way)? I'd like to somehow be able to ac...