Last active
December 10, 2015 17:08
-
-
Save puffnfresh/4465577 to your computer and use it in GitHub Desktop.
Define my own Unit which doesn't obey the crazy "value discarding" Scala rules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import language.implicitConversions | |
object Main { | |
object Unit | |
type Unit = Unit.type | |
implicit def unit2scalaunit(a: Unit): scala.Unit = () | |
implicit def scalaunit2unit(a: scala.Unit): Unit = Unit | |
def printHelloWorld: Unit = { | |
println("Hello World") | |
// Won't compile | |
// 100 | |
} | |
def main(args: Array[String]) { | |
printHelloWorld | |
printHelloWorld | |
} | |
} |
retronym
commented
Jan 6, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment