You do have empty angle brackets today, which indicate an inferred generic 
argument rather than a defaulted generic argument. See:

  1> let a = 1
a: Int = 1
  2> let b:Optional = a
b: Int? = 1

If Swift had defined Optional as Optional<Wrapped = Any>, statement 2 would be 
ambiguous.

I have a hard time coming up with a realistic generic which can have every 
argument defaulted. If someone can’t give a real-world example, I would require 
empty angle brackets just to differentiate defaulted vs inferred arguments.

-DW

> On Jan 23, 2017, at 12:25 PM, T.J. Usiyan via swift-evolution 
> <[email protected]> wrote:
> 
> I am against requiring empty angle brackets. I could live with it either way, 
> but I think that one reason to provide default types is to hide the detail 
> that there is a type parameter until such a time as it is needed.  Empty 
> angle brackets call attention to the feature in a manner that discards any 
> possible gains on this front. Empty angle brackets would be confusing to 
> explain to someone new to the language and–more importantly–shouldn't be 
> necessary to explain in the "falling back to defaults" case.
> 
> On Mon, Jan 23, 2017 at 1:41 PM, Trent Nadeau via swift-evolution 
> <[email protected] <mailto:[email protected]>> wrote:
> The proposal looks good to me with one possible concern. I'm leaning toward 
> types that use the defaults should still require the angle brackets, X<>. 
> This makes it clear that you're using a generic type. That leads me to think 
> that the examples Doug gave should be an error as the explicit types on the 
> `let`s should either be omitted completely or fully specified (as X<>, 
> X<Double>, X<Int>, etc.).
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to