I was going through the wonderful book, Programming in Scala when I came across a piece of code that just doesn't make sense to me:
def above(that: Element): Element = {
val this1 = this widen that.width
val that1 = that widen this.width
elem(this1.contents ++ that1.contents)
}
Note line 2 and 3:
val this1 = this widen that.width
It seems like I should be able to replace this with:
val this1 = this.widen that.width
However, when I try to compile this change, it gives the following error:
error: ';' expected but '.' found. val this1 = this.widen that.width ^
Can anyone explain to me why this syntax is unacceptable?
Thanks, Zack