Skip to content

Instantly share code, notes, and snippets.

class B {
def methodB(): String = ""
}
class A(b: B) {
def methodA(): String = b.methodB
}
class B
class A(b: B)
@liosedhel
liosedhel / puzzle_futures_eithers_and_seq.scala
Last active November 9, 2016 15:52
Future, Either, Seq problem
/**
* Simply, make it works!
*/
import scala.concurrent.Future
import scala.util.{Left, Random, Right}
import scala.concurrent._
type Error = Boolean
type Nin = String
case class Product(nin: String)
@liosedhel
liosedhel / TraitValInitializationHell.scala
Created April 24, 2016 21:54
Trait and vals initialization hell. Simple (but partial) explanation.
/* We start with very simple example */
/*scalac -print B.scala */
//[[syntax trees at end of cleanup]] // B.scala
//package <empty> {
// abstract trait B extends Object {
// <stable> <accessor> def a(): String
// };
// abstract trait B$class extends {
// def /*B$class*/$init$($this: B): Unit = {