我经历的精彩的书Programming in Scala,当我遇到了一段代码,只是没有任何意义,我就来了:斯卡拉点语法(或缺乏)
def above(that: Element): Element = {
val this1 = this widen that.width
val that1 = that widen this.width
elem(this1.contents ++ that1.contents)
}
注2号线3:
val this1 = this widen that.width
好像我应该能够替换此:
val this1 = this.widen that.width
然而,当我尝试编译这种变化,它提供了以下错误:
error: ';' expected but '.' found.
val this1 = this.widen that.width ^
这是为什么语法不能接受?
可能的重复:http://stackoverflow.com/questions/1181533/what-are-the-precise-rules-for-when-you-can-omit-parenthesis-dots-braces-fu和http:// stackoverflow.com/questions/1006967/scala-which-characters-can-i-omit – 2009-08-05 17:08:10