Why does Scala define a “+=” operator for Short and Byte types?
问题 Given the following scala code: var short: Short = 0 short += 1 // error: type mismatch short += short // error: type mismatch short += 1.toByte // error: type mismatch I don't questioning the underlying typing - it's clear that "Short + value == Int". My questions are: 1. Is there any way at all that the operator can be used? 2. If not, then why is the operator available for use on Short & Byte? [And by extension *=, |= &=, etc.] 回答1: The problem seems to be that "+(Short)" on Short class is