> On 22 Nov 2017, at 07:48, David Hart via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> 
> 
> On 22 Nov 2017, at 07:41, Douglas Gregor via swift-evolution 
> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
> 
>> 
>> 
>>> On Nov 21, 2017, at 10:37 PM, Chris Lattner <clatt...@nondot.org 
>>> <mailto:clatt...@nondot.org>> wrote:
>>> 
>>> On Nov 21, 2017, at 9:25 PM, Douglas Gregor <dgre...@apple.com 
>>> <mailto:dgre...@apple.com>> wrote:
>>>>> 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.
>>>> 
>>>> We don’t have a way to make it work for function types, though, because of 
>>>> parameter-passing conventions. Well, assuming we don’t invent something 
>>>> that allows:
>>>> 
>>>>    Function<Double, inout String>
>>>> 
>>>> to exist in the type system. Tuple labels have a similar problem.
>>> 
>>> I’m totally aware of that and mentioned it upthread.
>> 
>> Eh, sorry I missed it.
>> 
>>>  There are various encoding tricks that could make this work depending on 
>>> how you want to stretch the current generics system…
>> 
>> I think it’s straightforward and less ugly to make structural types allow 
>> extensions and protocol conformances.
> 
> Can somebody explain to me what is less ugly about that? I would have 
> naturally thought that the language would be simpler as a whole if there only 
> existed nominal types and all structural types were just sugar over them.

What confuses me is that I always thought that T? was sugar for Optional<T> by 
design, and found that to be quite elegant. But now you’re telling me that its 
just a hack to allow conformance on Optionals until it can be made structural. 
I would have thought that it would be cleaner to have specific concepts 
(optionals, tuples, etc…) represented in terms of more general concepts (enum, 
struct) so that the compiler had less to reason about. I’m just trying to 
understand :-)

>>      - Doug
>> 
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution@swift.org <mailto:swift-evolution@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution 
>> <https://lists.swift.org/mailman/listinfo/swift-evolution>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to