>    guard case let .Succeed(m) = returnsResult() else {
>         return it
>    }
>    // Can safely use m, otherwise Result is passed back the call stack.

I didn't understand what you wanted to begin with, so to summarize: you want to 
be able to bind the return value of `returnsResult()` to a constant on the 
`else` branch if the pattern doesn't match.

I definitely see the use case here, but I can't say I like the implicit use of 
`it`. If we did something like this, I would prefer it be done by decorating 
the `else`:

        guard case let .Succeed(m) = returnsResult() else let r {
                return r
        }

However, I'm honestly not sure that's much less burdensome than this:

        let r = returnsResult()
        guard case let .Succeed(m) = r else {
                return r
        }

It *is* a line less, and a constant less, but it also means adding a new and 
slightly funky syntax to the language. I'm just not sure it's worth it.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to