Skip to content

Instantly share code, notes, and snippets.

@patroclos
Last active March 16, 2019 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patroclos/f10e87787336bf02c802165e0b43a60b to your computer and use it in GitHub Desktop.
Save patroclos/f10e87787336bf02c802165e0b43a60b to your computer and use it in GitHub Desktop.
tested with pony 0.27.0-95d94ac [release] on Windows 10
trait val Tr is Stringable
fun string(): String iso ^
class val Y is Tr
new val create() => None
fun string(): String iso ^ => "Y".string()
// if this is only Tr, it won't crash
// it this is (Y | None), it won't crash
type Exp is (Tr | None)
//type Exp is (Y | None)
primitive Indirection
fun apply(): Exp val => Y
actor Main
new create(env: Env) =>
// if this is set to Y, instead of Indirection(), it won't crash
let testerino: Exp = Indirection()
// if we dont run testerino.string(), it won't crash
env.out.print(testerino.string())
env.out.print("One would assume that you'll see this line")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment