Two canonical examples for specialization:
- Function1
- Tuple2
Specializing Function1
is a lot easier because functions do not have specialized fields.
import java.util | |
import ichi.bench.Thyme | |
import scala.collection.mutable.ArrayBuffer | |
object ArrayBufferInsertBench extends App { | |
val th = Thyme.warmed(verbose = println) | |
// val th = new Thyme() |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
import java.io._ | |
import java.util.zip.ZipInputStream | |
import geny.Generator | |
import mill._ | |
import mill.define.Target | |
import mill.scalajslib._ | |
object WebpackLib { |
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.