This seems like a welcome change and leaves the door open for the future
inclusion of type unions. Nicely done!

Regarding this approximation operator, I have a question about the intended
meaning of:

~struct{
  F int
  A string
}

Would this match the following types?

type A struct{
  F int
  A string
}

type B struct{
  A string
  F int
}

type C struct{
  X int
  Y string
}

type D struct{
  F int
  A string
  B float
}

My guess is that we're talking about an exact type match, so it would
definitely match A, I'm not sure about B without checking the compiler, and
I don't think it would match either C or D under the current proposal.

I think it could potentially be useful to have this approximation operator
match type D, although that would require modifying the proposal to specify
some notion of "field sets", which seems like it could be a departure from
how Go currently views structs and therefore may introduce further
complications I am not aware of. Just curious if it's already been
considered and discarded.

Thanks!

On Thu, Apr 1, 2021, 5:59 PM Ian Lance Taylor <i...@golang.org> wrote:

> We've just posted a potential update to the generics proposal at
> https://golang.org/issue/45346.  This clarifies and simplifies the
> type lists that appear in interfaces, and let's us drop the "type"
> keyword used to mark such lists.
>
> Ian
>
> --
> 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/CAOyqgcVEx53D7YmFRBe43_jcrVSt%2BPbDEYjc4EZnpe1YyBNAtg%40mail.gmail.com
> .
>

-- 
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/CALJzkY9oy9m630f_04EZz9BXeS085nG6b04EoSdp%3DsnR%2BA4_Vg%40mail.gmail.com.

Reply via email to