> Am 22.11.2017 um 06:25 schrieb Douglas Gregor via swift-evolution 
> <swift-evolution@swift.org>:
> 
> 
> 
>>> On Nov 21, 2017, at 9:21 PM, Chris Lattner <clatt...@nondot.org> wrote:
>>> 
>>> 
>>> 
>>> On Nov 21, 2017, at 7:19 PM, Douglas Gregor via swift-evolution 
>>> <swift-evolution@swift.org> wrote:
>>> 
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>>> On Nov 21, 2017, at 3:46 PM, Tony Allevato <tony.allev...@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.
> 
> 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.
> 

Just throwing an idea out: what about

      Function<Double, InoutParam<String>, Param<Int>>

or

      Function<Double, Param<String, .inout>, Param<String>>

The latter assuming we had generics with value parameters (which is another 
common topic on this list) and defaults.
The first example might have the advantage of making use of inheritance between 
InoutParam and Param (which would require variance for type parameters, another 
common topic).

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

Reply via email to