Skip to content

Instantly share code, notes, and snippets.

View lrytz's full-sized avatar
🦉

Lukas Rytz lrytz

🦉
View GitHub Profile
(function(){
'use strict';
/* Scala.js runtime support
* Copyright 2013 LAMP/EPFL
* Author: Sébastien Doeraene
*/
/* ---------------------------------- *
* The top-level Scala.js environment *
* ---------------------------------- */
diff --git a/gistfile1.js b/gistfile1.js
index f69c967..be9136a 100644
--- a/gistfile1.js
+++ b/gistfile1.js
@@ -1035,14 +1035,18 @@ $h_O.prototype = $c_O.prototype;
$c_O.prototype.init___ = (function() {
return this
});
-$c_O.prototype.hashCode__I = (function() {
- return $m_jl_System$().identityHashCode__O__I(this)
abstract class A[T, R]{ def apply(x: T): R }
val x: A[Int, Int] = x => x + 1
val x: A[Int, Int] = (x: Int) => x + 1
val x: A[String, Int] = (x: String) => 1
val x: A[String, Int] = (x: Object) => 1
val x: A[Object, Int] = (x: String) => 1 // error expected
object O {
@lrytz
lrytz / hs_err_pid65467.log
Last active March 22, 2016 13:07
jvm crash
Use Scala 2.11.7.
$ cat A.scala
package test
object Test extends App {
def test(): Unit = {
println("testing...")
}
}
@lrytz
lrytz / A.asm
Last active April 20, 2016 12:55
javac produces bytecode that causes NoSuchMethodError
// class version 52.0 (52)
// access flags 0x21
public class A {
// compiled from: A.java
// access flags 0x9
public static INNERCLASS A$K A K
// access flags 0x609
public static abstract INNERCLASS A$I2 A I2
// access flags 0x609
diff -r /Users/luc/scala/scala2/src/eclipse/README.md src/eclipse/README.md
48a49,55
> 0. The 2.12, sources of Scala need to be built with a 2.12 version of the compiler. One can configure a 2.12 Scala installation
> in Eclipse. In order to do this, go to `Window -> Preferences -> Scala -> Installations` and add a 2.12 installation. You can
> either download a prepackaged version of 2.12 from the Scala homepage or you add the Scala installation that is part of the
> `build/pack/lib` directory. The latter is required in case you absolutely need to depend on a nightly build of the compiler to
> compile the compiler itself. Once the 2.12 Scala installation is created you need to select all Scala projects, do a right click
> and select `Scala -> Set the Scala installation` where you have to choose the newly created 2.12 Scala installation.
>
diff -r /Users/luc/scala/scala2/src/eclipse/partest/.classpath src/eclipse/partest/.classpath
Only in /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/2.11.9-SNAPSHOT: bundles
Binary files /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/2.11.9-SNAPSHOT/docs/scala-compiler-javadoc.jar and /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/kopy/docs/scala-compiler-javadoc.jar differ
diff -r /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/2.11.9-SNAPSHOT/docs/scala-compiler-javadoc.jar.md5 /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/kopy/docs/scala-compiler-javadoc.jar.md5
1c1
< 07a8dab7eb5ce4d668aca42c4afdd18c
\ No newline at end of file
---
> e7c9f9f176df18758c497955b4072e88
\ No newline at end of file
diff -r /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/2.11.9-SNAPSHOT/docs/scala-compiler-javadoc.jar.sha1 /Users/luc/.ivy2/local/org.scala-lang/scala-compiler/kopy/docs/scala-compiler-javadoc.jar.sha1
@lrytz
lrytz / gist:7156173feaffcb9f419c949d05defb5e
Last active July 1, 2016 14:01
Performance of using default methods to compile Scala trait methods

Performance of using default methods to compile Scala trait methods

In Scala 2.12, bodies of methods defined in traits will be compiled to default methods in the interface classfile. In short, we have the following bytecode formats for concrete trait methods:

  • 2.11.x: trait method bodies are in static methods in the trait's T$impl class. Classes extending a trait get a virtual method that implements the abstract method in the interface and forwards to the static implementation method.
  • 2.12.0-M4: trait method bodies are in (non-static) interface default methods, subclasses get an virtual method (overridding the default method) that forwards to that default method using
diff --git a/ImplClassesAreTopLevel$$anon$14.asm b/ImplClassesAreTopLevel$$anon$14.asm
index baf4f97..883f1b9 100644
--- a/ImplClassesAreTopLevel$$anon$14.asm
+++ b/ImplClassesAreTopLevel$$anon$14.asm
@@ -1,6 +1,6 @@
// class version 52.0 (52)
// access flags 0x31
-public final class ImplClassesAreTopLevel$$anon$14 implements ImplClassesAreTopLevel$B3$1 {
+public final class ImplClassesAreTopLevel$$anon$14 implements ImplClassesAreTopLevel$B2$1 {
@lrytz
lrytz / program.md
Last active September 13, 2016 09:35

9.00 Day Two Welcome

Auditorium

9.30 Tuesday Keynote

Josh Suereth, Dick Wall, Auditorium

Josh and Dick will take a deep dive into one of Scala's more advanced language constructs: the for expression. In this coding-example-heavy talk we will cover topics like:

  • For, it's not about looping