

Scala-js v0.3 released - iamtechaddict
https://github.com/scala-js/scala-js

======
saryant
Scala-JS has been making very fast progress lately, the 0.1 release wasn't
that long ago. I'm excited to see where it goes and I think there's room for
some very cool integrations with Play.

~~~
wiradikusuma
With no intention of downplaying it, but I think the biggest "blocker" is the
resulting file size, making it unfeasible for production.

~~~
gmt2027
The "Hello World" example is over 80Mb after compilation.

~~~
lihaoyi
We've managed to get a hello world app down to about 300kb; most of that is
the standard library, and even a several-1000-LOC game like
[roll]([http://lihaoyi.github.io/roll/](http://lihaoyi.github.io/roll/))
clocks in at about 340kb. Getting this number down is WIP.

------
brandonbloom
The title mentions Futures & Promises, but the link is directly to the GitHub
project without any further information about those concurrency constructs.

I'm curious if they managed to implement the blocking operations of Future
[1], such as the "result" method. And, if so, did they accomplish that using
the same Continuation Passing Style transform that Scala's Delimited
Continuations [2] plugin uses, or some other means?

[1]: [http://www.scala-
lang.org/files/archive/nightly/docs/library...](http://www.scala-
lang.org/files/archive/nightly/docs/library/index.html#scala.concurrent.Future)

[2]: [http://www.scala-
lang.org/api/current/index.html#scala.util....](http://www.scala-
lang.org/api/current/index.html#scala.util.continuations.package)

~~~
lihaoyi
It uses normal Scala `Future`s. You get two `ExecutionContext`s: `queued` and
`runNow`. You can't block on a `Future`. That covers just about all the
ScalaJS specific stuff, the rest is plain Scala.

Take a look at
[Scala.Rx]([https://github.com/lihaoyi/scala.rx](https://github.com/lihaoyi/scala.rx))
or
[uTest]([https://github.com/lihaoyi/utest](https://github.com/lihaoyi/utest))
if you want to see code examples of how `Future`s are used in ScalaJS, but I
think you'll be disappointed: it's exactly the same code that gets run on
Scala-JVM!

~~~
brandonbloom
You said:

> You can't block on a `Future`

Which answers my question. Thank you.

But then you also said:

> it's exactly the same code that gets run on Scala-JVM

That can't be exactly true, since "Awaitable" [1] doesn't appear anywhere in
the scala-js codebase. So I guess as long as you don't mention that trait by
name, or attempt to block on a future, then your effectively duck-typed Scala-
JVM code will be able to run unmodified on Scala-JS.

[1]: [http://www.scala-
lang.org/files/archive/nightly/docs/library...](http://www.scala-
lang.org/files/archive/nightly/docs/library/index.html#scala.concurrent.Awaitable)

