can you outline how extensions and protocol conformances might look
for structural types? to compare the ugliness of both approaches.
Mike
···
on Date: Tue, 21 Nov 2017 22:54:21 -0800 Douglas Gregor <dgregor@apple.com> wrote:
On Nov 21, 2017, at 10:48 PM, David Hart <david@hartbit.com> wrote:
>
> On 22 Nov 2017, at 07:41, Douglas Gregor via swift-evolution < > swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>
>>
>> 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.See Thorsten’s response with, e.g.,
Function<Double, InoutParam<String>, Param<Int>>
which handles “inout” by adding wrappers around the parameter types (which
one would have to cope with in any user of Function), but still doesn’t
handle argument labels. To handle argument labels, we would need something
like strings as generic arguments. We’d also need to handle calling
conventions and anything else we invent for function types.