+ 2'yi çağırdığımda Int'e geri döndüğümde, ancak açık yöntem kullanılarak yapılan arama bittiğinde, Double olsun.Scala operatörü oddity
scala> 2+2
res1: Int = 4
scala> 2.+(2)
res2: Double = 4.0
Öyle görünüyor ki, örtük dönüştürülmüş Int'den Double'e (+) dönüştürülür.
scala> 2.+
<console>:16: error: ambiguous reference to overloaded definition,
both method + in class Double of type (x: Char)Double
and method + in class Double of type (x: Short)Double
match expected type ?
2.+
^
Neden böyle?
Java uyumluluğu: - garip/ – soc