Wouldn't it be reasonable if code like …
def scramble(f: Float) = f
scramble(1234567890L)
// => 1.23456794E9
… was a compiler error instead of converting our Long
to a Float
?
What about …
List(10, 5, 2.5)
If we don't convert 10
and 5
to Doubles
,
what will be the element type of List
?
List[AnyVal]
Pretty useless: AnyVal
offers no useful methods!
List[Int|Double] // with union types ...
Useless, but at least we know what went wrong!