> On Jul 5, 2017, at 2:23 PM, Dave Abrahams via swift-evolution
> <[email protected]> wrote:
>
> I am not convinced this syntactic sugar is worth complicating the
> language or library for,
For what it's worth, I think it is *totally* worth complicating the language or
library. The manual alternative involves a ton of obfuscating code and
punctuation:
person.map { $0[keyPath: myKeyPath] } // Don't tell me this isn't
horrible.
> but if it is, IMO the right thing is to make a
> keypath be-a subtype of the appropriate function type, rather than to
> start down the path of creating a keypath overload for every method that
> takes a closure argument.
However, I think making `KeyPath<Foo, Bar>` a subtype of `(Foo) -> Bar` is a
great way of handling this whole problem in one fell swoop—as long as it
doesn't get delayed three or four versions while we clean up the type system.
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution