I was going through the effective scala slides and it mentions on slide 10 to never use val in a trait for abstract members and use def
val
trait
def
Always using def seems a bit awkward since something like this won't work:
trait Entity { def id:Int} object Table { def create(e:Entity) = {e.id = 1 } }
You will get the following error:
error: value id_= is not a member of Entity