Guard unowned / while unowned

Coming back to the original question: I think this should be solved with this pitch: borrow and inout declaration keywords. This will allow you to write:

guard borrow let firstNode else {
    return
}

This doesn't "copy" the value and therefore should not emit a retain/release pair IIRC.

while isn't called out explicitly in the proposal but I think its just an oversight. Feel free to ask in the pitch thread though.

1 Like