+1. Would think that all variants should exist on Optional too unless it would be harmful.<br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 7, 2017 at 20:13 Michael J LeHew Jr via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a great idea, and ought to be easy enough to bring forward! +1 from me!<br>
<br>
-Michael<br>
<br>
> On Jun 7, 2017, at 11:18 AM, Matt Diephouse via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
><br>
> 💯<br>
><br>
>> On Jun 7, 2017, at 10:35 AM, Adam Sharp via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
>><br>
>> The new smart key path feature is really lovely, and feels like a great addition to Swift.<br>
>><br>
>> It seems like it might be straightforward to add overloads of `map` and `flatMap` to the standard library to make use of the new functionality:<br>
>><br>
>> let managers = flatOrganisation.managers<br>
>> let allEmployees = Set(managers.flatMap(\.directReports))<br>
>> let employeeNames = Set(allEmployees.map(\.name))<br>
>><br>
>> This feels like a really natural way of working with key paths in a functional style. It makes a lot of sense for collections, and possibly for Optional too (although as far as I can see optional chaining is more or less equivalent, and with more compact syntax).<br>
>><br>
>> I’m hoping that this might be low-hanging fruit that could be considered for the Swift 4 release. I’d be happy to have a go at writing a proposal if there’s interest!<br>
>><br>
>> –Adam<br>
>><br>
>> _______________________________________________<br>
>> swift-evolution mailing list<br>
>> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
><br>
> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>