Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-05 Thread Ricardo Parada via swift-evolution
Thanks Brent. Was that real code? :-) If it was, I did not realize it was possible to do something like that in Swift. That seems very cool, attractive and powerful. It certainly would look much better with the sugary syntax. I can imagine building a collection of sort orderings like this fo

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-05 Thread Michael J LeHew Jr via swift-evolution
> On Apr 3, 2017, at 1:47 PM, Joshua Alvarado via swift-evolution > wrote: > > Example: > struct Foo { > var firstName: String > var lastName: String > } > You would need to spell out #keyPath(Foo, .firstName) here, or decorate the type on keyPaths like so: let keyPaths : [KeyPath]

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread Joe Groff via swift-evolution
> On Apr 3, 2017, at 1:47 PM, Joshua Alvarado via swift-evolution > wrote: > > Quesition about this proposal. Will it be possibly to create an array of > keyPaths and set an objects value with enumeration. > > Example: > struct Foo { > var firstName: String > var lastName: String > }

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread Joshua Alvarado via swift-evolution
Quesition about this proposal. Will it be possibly to create an array of keyPaths and set an objects value with enumeration. Example: struct Foo { var firstName: String var lastName: String } let keyPaths = [#keyPath(.firstName), #keyPath(.lastName)] for key in keyPaths { foo[keyPath

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread Joe Groff via swift-evolution
> On Apr 3, 2017, at 7:24 AM, Ricardo Parada via swift-evolution > wrote: > > By the way, does anybody know why the proposed syntax require a leading > period for the key path? > > #keyPath(Family, .pets.first) Grammatically, it's a series of postfix expression components, including propert

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread Tony Allevato via swift-evolution
On Thu, Mar 30, 2017 at 9:25 AM Douglas Gregor via swift-evolution < swift-evolution@swift.org> wrote: > Hello Swift community, > > The review of SE-0161 "Smart KeyPaths: Better Key-Value Coding for Swift" > begins now and runs through April 5, 2017. The proposal is available here: > > > https://g

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread James Berry via swift-evolution
> On Apr 3, 2017, at 8:27 AM, James Berry wrote: > > On balance, I’m +1 on this proposal, with caveats below… > > I’ve expressed, I don’t really like the #keyPath(Foo, .bar.baz) syntax, > because I feel it is confusing to differentiate from the more natural > #keyPath(Foo.bar.baz) legacy synt

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread Zach Waldowski via swift-evolution
On Thu, Mar 30, 2017, at 12:25 PM, Douglas Gregor wrote: > * What is your evaluation of the proposal? Weak +0.5. This is absolutely needed, and I don't want to see the feature broken down any further through interminable bikeshedding, so I'd be more willing to let it ride as-is than miss out on

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread Ricardo Parada via swift-evolution
By the way, does anybody know why the proposed syntax require a leading period for the key path? #keyPath(Family, .pets.first) In other words, why not just this: #keyPath(Family, pets.first) Or Brent's proposed: #keyPath(pets.first) > On Apr 3, 2017, at 2:08 AM, Brent Royal-Gordon via sw

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-03 Thread David Hart via swift-evolution
> What is your evaluation of the proposal? I am very excited about the usefulness of this proposal right now and about its potential in the future. This is big step towards enabling a lot of “dynamic” features. But, like Brent, I continue to think that the syntax is much too heavy: I was a big

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-02 Thread Brent Royal-Gordon via swift-evolution
> Proposal link: > https://github.com/apple/swift-evolution/blob/master/proposals/0161-key-paths.md > • What is your evaluation of the proposal? I continue to believe that the chosen syntax is unnecessarily cumbersome, that the design is overly conservative in terms of making sure people

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-01 Thread Brent Royal-Gordon via swift-evolution
> On Apr 1, 2017, at 5:56 PM, Karl Wagner via swift-evolution > wrote: > >> let isPuppyQualifier = Pet.type.equals(.dog).and(Pet.age.lessThan(12)) >> let familyQualifier = Family.pets.hasAtLeastOne(satisfying: isPuppyQualifier) >> let familiesWithPuppies = Family.fetch(editingContext, familyQua

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-01 Thread Karl Wagner via swift-evolution
> On 2 Apr 2017, at 02:56, Karl Wagner wrote: > > struct UnaryPredicate { > let evaluate: (Parameter) -> Bool > } > struct BinaryPredicate { > let evaluate: (Left, Right) -> Bool > } > > extension KeyPath where Value: Equatable { > func equals(_ value: Value) -> UnaryPredicate { >

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-01 Thread Karl Wagner via swift-evolution
> I wish CoreData (or similar object-to-relational-mapping module) in Swift > eventually leverage smart keys and key paths to make our code beautiful when > building sort orderings, qualifiers (predicates or whatever they are called > in CoreData) to build queries or apply them in-memory to arra

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-01 Thread Ricardo Parada via swift-evolution
> On Mar 30, 2017, at 12:25 PM, Douglas Gregor via swift-evolution > wrote: > > Hello Swift community, > > The review of SE-0161 "Smart KeyPaths: Better Key-Value Coding for Swift" > begins now and runs through April 5, 2017. The proposal is available here: > > https://github.com/apple/swift

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-01 Thread Tino Heth via swift-evolution
-1 (there has always somebody who disagrees ;-) Yes, KeyPaths are nice, solve a problem that's probably significant, and type safety is very important in Swift… but I don't think it's that urgent to have this feature now: Maybe there are some secret plans that depend on smart KeyPaths, but from

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-04-01 Thread Matthew Johnson via swift-evolution
> > What is your evaluation of the proposal? +1. This is a fantastic proposal! I have been looking forward to the ability to access unbound properties ever since Swift was first released. I am very happy to see it coming to the language. The design of this feature is even better than I had

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-03-31 Thread Pranshu Goyal via swift-evolution
- What is your evaluation of the proposal? +1 - Is the problem being addressed significant enough to warrant a change to Swift? Yes - 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,

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-03-30 Thread Rien via swift-evolution
> • What is your evaluation of the proposal? +1 > • Is the problem being addressed significant enough to warrant a change > to Swift? I do not see this as a problem, but as added functionality that would be beneficial > • Does this proposal fit well with the feel and direc

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-03-30 Thread Joe Groff via swift-evolution
> On Mar 30, 2017, at 1:08 PM, Karl Wagner via swift-evolution > wrote: > >> • What is your evaluation of the proposal? > +1 > >> • Is the problem being addressed significant enough to warrant a change >> to Swift? > Yes > >> • Does this proposal fit well with the feel and dir

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-03-30 Thread Dominik Pich via swift-evolution
> What is your evaluation of the proposal? +1 > Is the problem being addressed significant enough to warrant a change to > Swift? Yes > 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 fee

Re: [swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-03-30 Thread Karl Wagner via swift-evolution
> What is your evaluation of the proposal? +1 > Is the problem being addressed significant enough to warrant a change to > Swift? Yes > 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 fee

[swift-evolution] [Review] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

2017-03-30 Thread Douglas Gregor via swift-evolution
Hello Swift community, The review of SE-0161 "Smart KeyPaths: Better Key-Value Coding for Swift" begins now and runs through April 5, 2017. The proposal is available here: https://github.com/apple/swift-evolution/blob/master/proposals/0161-key-paths.md Reviews are an important part of the Swift