scala-js/scala-js — pull request #450 by sjrd (2014-04-06 10:40:14+00:00)
Title: Fix #395: Sanitize boxing in JS interop.

Until now, the way boxing has been handled in JS interop has
been implementation-driven (least effort), giving un-spec'able
semantics. This commit fixes this by giving the following simple
semantics to Scala data types seen from JavaScript code
(in all circumstances):

```
+---------------------------------+------------------+
| Scala types | JavaScript types |
+---------------------------------+------------------+
| Boolean | boolean |
| Byte, Short, Int, Float, Double | number |
| String | string |
| Unit (value `()`) | undefined |
| Null (value `null`) | null |
+---------------------------------+------------------+
```

(the canonical Scala type for JS number being Double.)

All types inheriting from js.Any are, of course, themselves,
from JavaScript's point of view.

All other types (including Char, Long, and value classes) are
opaque data types that cannot be manipulated from JavaScript,
other than calling toString() and accessing @JSExport'ed members.

From an implementation point of view, these semantics boil down
to a dead simple rule: everything is always boxed in JavaScript.