Skip to content

Instantly share code, notes, and snippets.

View pstutz's full-sized avatar

Philip Stutz pstutz

  • Justement GmbH
  • Zurich, Switzerland
View GitHub Profile

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.

@nafg
nafg / Webpack.sc
Last active August 16, 2022 23:25
import java.io._
import java.util.zip.ZipInputStream
import geny.Generator
import mill._
import mill.define.Target
import mill.scalajslib._
object WebpackLib {

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

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
@rklaehn
rklaehn / ArrayBufferInsertBench.scala
Created December 13, 2014 11:23
Benchmark for SI-9043
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()
@gkossakowski
gkossakowski / specialization-mh.md
Created January 11, 2013 21:17
Random ideas from Scala compiler hacker (@gkossakowski) on how we could improve specialization scheme by exploiting MethodHandles. What you read below is not a plan or a commitment of any kind. I just wanted to get it out from my head and hear what other people think while I'm busy with other things.

Specialization with method handles

Two canonical examples for specialization:

  • Function1
  • Tuple2

Function1 specialization

Specializing Function1 is a lot easier because functions do not have specialized fields.