stavo attraversando il bellissimo libro Programming in Scala quando mi sono imbattuto in un pezzo di codice che proprio non ha senso per me:sintassi del punto Scala (o mancanza)
def above(that: Element): Element = {
val this1 = this widen that.width
val that1 = that widen this.width
elem(this1.contents ++ that1.contents)
}
nota linea 2 e 3:
val this1 = this widen that.width
sembra che dovrei essere in grado di sostituire questo con:
val this1 = this.widen that.width
.210
Tuttavia, quando provo a compilare questo cambiamento, dà il seguente errore:
error: ';' expected but '.' found.
val this1 = this.widen that.width ^
Perché questa sintassi accettabile?
Possibili duplicati: http://stackoverflow.com/questions/1181533/che cosa-are-il-precise-rules-for-when-you-can-omit-parenthesis-dots-braces-fu e http: // stackoverflow.com/questions/1006967/scala-which-characters-can-i-omit –