On Monday, 3 August 2020 at 19:46:05 UTC+2 Ian Lance Taylor wrote:

> Yet another possibility, going back to the syntax question above, is 
> requiring that a type parameter for a type alway have a constraint, 
> which would mean that we would never use the "type" keyword for type 
> parameters, and define a predeclared identifier "any = interface{}". 
>

Thanks for considering this possibility. Why I like it:

   - Type parameter lists and function parameter lists have the same 
   structure. Constraint is to type parameter as type is to function parameter.
   - Even more symmetry between declaration and instantiation than before: 
   No "type" keyword at instantiation, no "type" keyword at declaration.
   - Type parameter lists do not suddenly take on a different shape when 
   they are a mixture of constrained and unconstrained type parameters 
   compared to fully unconstrained type parameter lists:
      - Without "type" keyword
         - [A, B any] and [A any, B comparable] // No surprise
      - With "type" keyword
         - [type A, B] and [type A interface{}, B comparable] // A wild 
         interface{} appears!
      

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/177f43c1-70d9-4c24-8eee-e2e02cc81925n%40googlegroups.com.

Reply via email to