axel.wa...@googlemail.com schrieb am Dienstag, 18. August 2020 um 20:47:12 
UTC+2:

> We already have a way to express "any of a certain subset of types", which 
> are interfaces, so using them for constraints is natural.
>

I'd argue that every type expresses a certain subset of types, not just 
interfaces. For the other types the size of the subset just happens to be 1 
(each containing just itself). So every type should be usable as 
constraint. Types, constraints, ... I don't see a difference anymore. 
Constraints are just types used in the type parameter list on the left.
 

> it's about avoiding a new *concept*.
>

Type lists are still a new concept. Just because they hide inside 
interfaces doesn't mean that they are not a new concept. I'd prefer it to 
be honest and give them a name, with the possibility to use them as sum 
types in the future.
 

> No, it is neither the same, nor is it nonsensical. `interface{ type int }` 
> is any type with *underlying type* `int`, not just `int`. It adds some 
> expressive power. I'm not sure how important that expressive power is, but 
> it's more than zero.
>

On the go2go.dev branch they recently made a change to use the actual (not 
underlying) types of type list elements for interface satisfaction: 
https://github.com/golang/go/commit/af48c2e84b52f99d30e4787b1b8d527b5cd2ab64
 

-- 
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/96914146-3f4e-4972-a18a-3d6b957acb90n%40googlegroups.com.

Reply via email to