if let key = key, value = dict[key] { ...whatever... } seems to work fine without introducing a new construct
-- E, waving hi to John > On Dec 22, 2015, at 4:37 AM, John Holdsworth via swift-evolution > <swift-evolution@swift.org> wrote: > > This isn’t the most compelling of ideas but a couple of times I’ve found > myself writing: > > if let value = key != nil ? dict[key] : nil {… > > and was wondering if the syntax could be: > > if let value = dict[key?] {… > > The key for dictionaries could be made optional in stdlib but this is > probably best implemented in the compiler for safety. > > Cheers > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution