Skip to content

Instantly share code, notes, and snippets.

View sjrd's full-sized avatar

Sébastien Doeraene sjrd

View GitHub Profile
var $fround = (Math.fround || (((typeof Float32Array) !== "undefined") ? (function(v) {
var array = new Float32Array(1);
array[0] = v;
return array[0]
}) : (function(v) {
if (((v !== v) || (v === 0))) {
return v
};
var isNegative = (v < 0);
var av = (isNegative ? (-v) : v);

Here is a non-exhaustive list of libraries that are known to support Scala.js 1.x at the moment. They are shown with sbt libraryDependencies syntax, and grouped by organization.

Libraries

"org.scala-js" %%% "scalajs-dom" % "1.0.0"
"org.scala-js" %%% "scalajs-java-time" % "1.0.0"
"org.scala-js" %%% "scalajs-java-logging" % "1.0.0"

Advance the support of Scala.js in Dotty, a tutorial

Dotty contains preliminary support for Scala.js under the flag -scalajs. Or rather, it contains the infrastructure for preliminary support. It is far from being actually usable, but this is where you can help!

This small tutorial walks you through a few steps that you can do to further the support of Scala.js in Dotty. Even if you do not typically contribute to a compiler, this can be your chance. It is not very difficult, given that there already exists an extensive test suite, as well as a working implementation for scalac.

// source code
def test3(x: Int, y: Int): Int = (x: @switch) match {
case 6 if y > 5 => 1
//case 6 => 2
case 12 => 3
case 14 => 4
case _ => 5
}
// dotty emits this if `case 6 =>` is present
C:\Users\Sepi\Documents\Projets\dotty>sbt
[info] Loading settings for project global-plugins from plugins.sbt ...
[info] Loading global plugins from C:\Users\Sepi\.sbt\1.0\plugins
[info] Loading settings for project dotty-build-build from build.sbt ...
[info] Loading project definition from C:\Users\Sepi\Documents\Projets\dotty\project\project
[info] Loading settings for project dotty-build from build.sbt,inject-sbt-dotty.sbt,plugins.sbt,scripted.sbt ...
[info] Loading project definition from C:\Users\Sepi\Documents\Projets\dotty\project
[info] Updating ProjectRef(uri("file:/C:/Users/Sepi/Documents/Projets/dotty/project/"), "dotty-build")...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
diff --cc ci/checksizes.sh
index ea2bc7b11,38da8916e..000000000
--- a/ci/checksizes.sh
+++ b/ci/checksizes.sh
@@@ -17,7 -20,10 +17,10 @@@ case $FULLVER i
2.13.0-M4)
VER=2.13.0-M4
;;
+ 2.13.0-M5)
+ VER=2.13.0-M5
package <empty> {
final lazy module val foo: foo$ = new foo$()
@scala.annotation.internal.SourceFile("tests/pos/t10387b.scala") final module
class
foo$() extends Object() {
@scala.annotation.internal.Child[foo.Bit1]() @
scala.annotation.internal.Child
[foo.Bit0]() @scala.annotation.internal.Child[foo.One]() sealed abstract
class
num() extends Object() {}
This file has been truncated, but you can view the full file.
Started by upstream project "scalajs-matrix-build" build number 6169
originally caused by:
Started by upstream project "scalajs-nightly-0.6.x" build number 56
originally caused by:
Started by timer
Building remotely on lampscalatst3-a (auxjvm checkin nightly) in workspace /localhome/jenkins/a/workspace/scalajs-task-worker_2
Wiping out workspace first.
Cloning the remote Git repository
Cloning repository https://github.com/scala-js/scala-js/
> git init /localhome/jenkins/a/workspace/scalajs-task-worker_2 # timeout=10
@sjrd
sjrd / results.txt
Created February 5, 2018 19:57
SHA-512 benchmarks on d8: BigInt vs user-space implementation of 64-bit integers
$ /path/to/d8 --harmony-bigint sha512-with-bigint.js
SHA512: 5,630,596.850000001 us +- 27,217.38445487771 us
$ /path/to/d8 sha512-with-runtime-long.js
SHA512: 89,810.44117647059 us +- 613.7286544584218 us
@sjrd
sjrd / build.sbt
Created December 9, 2017 21:02
Trying to reproduce https://github.com/scala-js/scala-js/issues/3218 (no luck so far)
enablePlugins(ScalaJSPlugin)
scalaVersion := "2.12.4"
scalaJSUseMainModuleInitializer in Test := true
scalaJSModuleKind := ModuleKind.CommonJSModule