On 17.03.2017 20:04, Michael LeHew via swift-evolution wrote:
Hi friendly swift-evolution folks,
The Foundation and Swift team would like for you to consider the following
proposal:
Many thanks,
-Michael
Smart KeyPaths: Better Key-Value Coding for Swift
...
Just my 2 cents. FWIW, I feel like the proposed syntax is VERY confusing.
Person.friends[0].name - like access to static property. T.method can't
have subscript for it and then some field. So, I believe such key paths
deserve its own syntax.
luke[path] - very close to access the subscript of instance. In compare to
T.method, we can call result of T.method(i.e. let m = T.method; m()), just
like the T.method itself(foo.method()). But here we are calling some kind
of subscript instead of access property by "path".
There is no some 'special' marker for me that saying "hey, there is
references to properties used" from the first look.
Probably we can consider another separators, like
Person:friends[0].name
luke:path
Person->friends[0].name
luke->path
Person[friends[0].name] // single brackets for type
luke[[path]] // double brackets for instance
Person@friends[0].name
luke@path
or other with help of community.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution