> Le 7 nov. 2016 à 04:52, Chris Lattner via swift-evolution > <swift-evolution@swift.org> a écrit : > > >> On Nov 3, 2016, at 10:04 AM, Haravikk via swift-evolution >> <swift-evolution@swift.org> wrote: >> >> To avoid hijacking the guard let x = x thread entirely I've decided to try >> to write up a proposal on type narrowing in Swift. >> Please give your feedback on the functionality proposed, as well as the >> clarity of the proposal/examples themselves; I've tried to keep it >> straightforward, but I do tend towards being overly verbose, I've always >> tried to have the examples build upon one another to show how it all stacks >> up. > > FWIW, we have specifically considered something like this proposal in the > past. You didn’t mention it, but the ?: operator is a specific example that > frequently comes up. People often expect to be able to do something like: > > … = foo is B ? foo.bMethod() : … >
For the case of the ?: operator, I think it can be replaced by a ?? operator for most cases: … = (foo as B)?.bMethod() ?? … _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution