Re:From first principles: Why I bet on Scala.js
by oever on Thursday August 11, 2016 @12:08PM
(#12269390)
One of the main points of the blog is that Scala.js integrates well with the JavaScript apis and those apis are full of null. A typical loop in the DOM looks like this:
Perhaps those interfaces use the Option class?
[ Parent
| on HN ]
Re:From first principles: Why I bet on Scala.js
by oever on Thursday August 11, 2016 @06:14PM
(#12272019)
I wrote a small test function. It appears that Scala.js has no default protections against null values from the browser DOM.
def printNodes(targetNode: dom.Node): Unit = {
var c = targetNode.firstChild
while (c != null) {
if (c.nodeValue != null) {
println(c.nodeValue)
}
c = c.nextSibling
}
}
The return value from firstChild and nextSibling can be null.