> On 6 Apr 2017, at 16:29, Ricardo Parada via swift-evolution > <swift-evolution@swift.org> wrote: > > Another thought on the use of single quotes (an possibly the proposed escape > character). Do you think the closing single quote could be made optional > since key paths cannot have spaces? Or would that be confusing for beginners?
Key paths can (probably) have spaces: Welcome to Apple Swift version 3.1 (swiftlang-802.0.48 clang-802.0.48). 1> Double.nan.isNaN $R0: Bool = true 2> Double . nan . isNaN $R1: Bool = true 3> Double .nan .isNaN $R2: Bool = true 4> Double. nan. isNaN error: extraneous whitespace after '.' is not permitted Double. nan. isNaN ^~ > For example, these two would be equivalent: > > let isPuppyPredicate = 'Pet.type == .dog && 'Pet.age < 12 > let isPuppyPredicate = 'Pet.type' == .dog && 'Pet.age' < 12 > > Or this: > > let isPuppyPredicate = \Pet.type == .dog && \Pet.age < 12 > let isPuppyPredicate = \Pet.type\ == .dog && \Pet.age\ < 12 > > You would use the closing character normally when wanting to invoke a method > on the key path object. > > Any thoughts?
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution