[swift-evolution] Synthesizing Equatable, Hashable, and Comparable for tuple types

Chris Lattner clattner at nondot.org
Tue Nov 21 23:21:17 CST 2017



> On Nov 21, 2017, at 7:19 PM, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> 
> Sent from my iPhone
> 
> On Nov 21, 2017, at 3:46 PM, Tony Allevato <tony.allevato at gmail.com <mailto:tony.allevato at gmail.com>> wrote:
> 
>> Does that mean that once structural types can conform to protocols, would the core team want to remove Optional as a nominal type and just use “T?”?
> 
> Yes; at least, it’s a direction we’ve discussed a number of times. 
> 
>> Or has that ship sailed because of source compatibility and you just don’t want to introduce any new nominals that shadow structurals?
> 
> typealias Optional<T> = T?
> 
> Should address source compatibility. 

Or alternatively, one could decide to make the generics system *only and forever* work on nominal types, and make the syntactic sugar just be sugar for named types like Swift.Tuple, Function, and Optional.  Either design could work.

-Chris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171121/b6aaf762/attachment.html>


More information about the swift-evolution mailing list