func main() {
printf("[%s] entered\n", #function)
let f = foo(1)
var v: Any = 1
if !(v is Bool) {
printf("v: %d\n", v as Int)
}
v = true
if v is Bool {
printf("v: %s\n", v as Bool ? "true" : "false")
}
v = Foo(bar: 20, baz: true)
if v is Foo {
let foo = v as Foo
printf("v: Foo(bar: %d, baz: %s)\n", foo.bar, foo.baz ? "true" : "false")
}
printf("[%s] foo returned\n", #function)
printf("%d\n", f)
printf("%d\n", duplicate(2) as Int)
}
43 — Answering the Existential Question – Samuel Giddins @ FrenchKit 2018