Hall of Fame

The Hall of Fame highlights occasions where the Scala.js project has contributed to other, larger projects.

Node.js/V8: Integer Arithmetic Bug

Prior to Node.js 0.10.29, comparing Int.MaxValue with Int.MinValue could yield a wrong result. Notably:

$ node
> 2147483647 > -2147483648
false

This Node.js bug was discovered by a test in Scala’s partest suite that we run for Scala.js.

Google Closure Compiler: Bad String Constant Folding

The Google Closure Compiler (GCC) applied a wrong algorithm to convert number literals to strings during constant folding: Instead of a conversion conforming to the ECMAScript standard, GCC used Java’s implementation of toString. For example, GCC constant folded the following code:

alert('A number: ' + 1.2323919403474454e+21);

into:

alert("A number: 1.2323919403474454E21");

Whereas the following would be correct:

alert("A number: 1.2323919403474454e+21");

This GCC bug was discovered while making improvements to Scala.js’ constant folder.

React: Dependency on Inheritance of Static Members

In the initial plans for React 0.14, React checked for the static flag isReactClass on classes extending React.Component. In ECMAScript 6, such static members are inherited by subclasses:

class Foo {}
Foo.x = 5;
class Bar extends Foo{}
Bar.x // -> 5

While this behavior is specified in ECMAScript 6, there is no reliable way to reproduce it in pure ECMAScript 5. This would have essentially meant that React would not work on some fully ECMAScript 5 compliant platforms, a notable example being Internet Explorer 10 and earlier.

After the discussion on the Scala.js bug, the React team changed the design and is now using a non-static method now.