[swift-evolution] 3.0 if-var workaround construction question

Dave Abrahams dabrahams at apple.com
Fri Dec 18 19:05:43 CST 2015

> On Dec 18, 2015, at 5:53 AM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>>    if var testStream = OutputStream(path: aPath) {
>>        print("Testing custom output", toStream: &testStream)
> What sticks out to me here is, why is OutputStream a value type at all? Does it have some sensible copying behavior? It looks like an OutputStream more or less represents an open file, which seems like a perfect use case for a reference type.

One reason is that we wanted to be able to use a String as an OutputStream.


More information about the swift-evolution mailing list