> https://github.com/apple/swift-evolution/blob/master/proposals/0161-key-paths.md
>  
> <https://github.com/apple/swift-evolution/blob/master/proposals/0161-key-paths.md>
> What is your evaluation of the proposal?
+1 in general 

BUT I absolutely dislike having to escape a key path with `\` which is 
absolutely counterintuitive IMHO.
Like Brent already wrote, the `\` has to encompass the full expression to avoid 
ambiguities; this is so foreign to how `\` usually works, i.e. only on the 
following character, that it further makes the syntax counterintuitive and ugly.

I would have preferred one of these

1.
@{Type.property[.property]*}
  // no ambiguities due to braces
  let kp = @{Person.bestFriend?.name}
  luke[keyPath: @{.bestFriend?.name}]

2.
@Type.property[.property]*
  // @ applies to whole expression to make unambiguous (just like Brent 
suggested for `\`)
  let kp = @Person.bestFriend?.name
  luke[keyPath: @.bestFriend?.name]

3.
Type@property[.property]*
  // @ applies to whole expression to make unambiguous (just like Brent 
suggested for `\`)
  let kp = Person@bestFriend?.name              
  luke[keyPath: @bestFriend?.name]

4.
Type@property[@property]*
  // no ambiguities due to different separators; might be used for method 
references as well
  let kp = Person@bestFriend?@name
  luke[keyPath: @bestFriend?@name]

5.
#keyPath(Type.property[.property]*)
  // no ambiguities due to parenthesis
  let kp = #keyPath(Person.bestFriend?.name)
  luke[keyPath: #keyPath(.bestFriend?.name)]


> Is the problem being addressed significant enough to warrant a change to 
> Swift?

Yes, definitely!

> Does this proposal fit well with the feel and direction of Swift?

Yes.

> If you have used other languages or libraries with a similar feature, how do 
> you feel that this proposal compares to those?


> How much effort did you put into your review? A glance, a quick reading, or 
> an in-depth study?

Followed much of the discussion, read the proposal.

-Thorsten

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to