Much like the other discussion, this is consistent with Java and is what the JVM does. What I got from the other discussions (eg. the Unsigned Arithmetic one) was that Scala does what Java/the JVM do when it comes to primitive types and arithmetic and conversions. I'd assume the same arguments there would apply here.

Also, I think someone mentioned in another thread that they thought Scala's documentation focused too much on easing Java users into Scala. So, while these types of problems (unsigned arithmetic, upconverting to int, NaN -> 0, etc) make sense to a Java user, they are clearly surprising to many other people. Perhaps this is yet another symptom of the problem of catering to Java converts and there should be more mention of this kind of obvious-if-your-a-java-programmer-not-so-obvious-otherwise behaviour in the documentation.

Thanks for sharing your thoughts on the flavor of Scala's documentation. We'd actually like to produce more documentation catered to users from Python/Ruby/C/C++, etc, but currently the vast majority of people producing documentation come from Java.

…It'd be helpful if more non-Java people stepped up to help out in pointing out these types of things that cause confusion by dropping these kinds of helpful hints into the API documentation. I'd immediately pull in this type of doc contribution if you (or others) were to submit such a thing as a pull request.

Cheers,
Heather

On Nov 7, 2011, at 5:09 PM, Tom Switzer wrote:

> Also, I think someone mentioned in another thread that they thought Scala's documentation focused too much on easing Java users into Scala. So, while these types of problems (unsigned arithmetic, upconverting to int, NaN -> 0, etc) make sense to a Java user, they are clearly surprising to many other people. Perhaps this is yet another symptom of the problem of catering to Java converts and there should be more mention of this kind of obvious-if-your-a-java-programmer-not-so-obvious-otherwise behaviour in the documentation.