Created
March 10, 2015 19:32
-
-
Save bjhomer/de7e630b0ce4d1f4d3b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
protocol FooProtocol { | |
func blah() | |
} | |
struct Foo : FooProtocol { | |
func blah() {} | |
} | |
struct FooTaker { | |
init(inout aFoo: FooProtocol) { | |
println("I got a foo! \(aFoo)") | |
} | |
} | |
let x: FooProtocol? = Foo() | |
if var foo = x { | |
FooTaker(aFoo: &foo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/bjhomer/de7e630b0ce4d1f4d3b6#file-gistfile1-txt-L18
What are the guarantees around
foo
's lifetime? Won't it go away with the stack?