Announcing JS.scala v0.1

I'm pleased to announce the initial releas of JS.scala. JS.scala compiles JavaScript source code to Scala source code, allowing you to write your web application entirely in JavaScript! Finally, the expressive power of JavaScript available on the JVM via Scala (some call it "the bytecode of the JVM bytecode").

How does it work? Well, given the JavaScript input:

const a = 42
const b = "Hello, World"
const sq = x => x * x
const dsq = x => {
  const dx = sq(x)
  return dx * dx
};
const d = dsq(a)

const exclaimer = {
  apply: name => name + "!"
}

exclaimer.apply("Hello, World")

We get the lovely Scala output:

val a = 42
val b = "Hello, World"
def sq (x:HandHolder) = x * x
def dsq (x:HandHolder) = {
  val dx = sq(x)
  dx * dx
}
val d = dsq(a)
object exclaimer {
  def apply (name:HandHolder) = name + "!"
}

exclaimer("Hello, World")

You can then compile this and deploy to production.

What about types?

Those who rely on their IDE for autocompletion, or their compiler for type-checking get nervous when they have to know the types of things, so the next step is to add Flow type inference (https://github.com/facebook/flow) types to AST to restrict the expressive power of JavaScript, but export valid Scala.

That's for v0.2 though (keep an eye on the repo)... for now it just replaces types with a "HandHolder" placeholder.