Found other issues. 1. In golang.org/design/43651-type-parameters <http://golang.org/design/43651-type-parameters#element-constraint-example> #constraints-apply-even-after-constraint-type-inference, there is a typo in the F4 function where FromString2 should be FromStrings2
2. In golang.org/design/43651-type-parameters <http://golang.org/design/43651-type-parameters#element-constraint-example> #operations-based-on-type-sets, the link "defined later" in "For special purpose operators like range loops, we permit their use if the type parameter has a structural constraint, as <defined later <https://go.googlesource.com/proposal/+/master/design/43651-type-parameters.md#Constraint-type-inference> >" points to golang.org/design/43651-type-parameters <http://golang.org/design/43651-type-parameters#element-constraint-example> #Constraint-type-inference. This feels confusing to me. What does type inference have to do with structural constraints? I think that the definition of "structural type" and "structural constraint" should be moved in a different section. Note that the term "structural constraint" is also used at the start of the document, in golang.org/design/43651-type-parameters <http://golang.org/design/43651-type-parameters#element-constraint-example>#background, but I'm not sure if it has the meaning as the term used in the type inference section. 3. I noted that in the design there are no examples of a generic function that use the range statement over array, slice, string or map. What is the reason? P.S: should I report these issues on the Github Issue or on golang-dev? Thanks Manlio On Thursday, January 20, 2022 at 9:12:31 AM UTC+1 Manlio Perillo wrote: > I found other 2 issues: > > 1. In golang.org/design/43651-type-parameters#element-constraint-example, > the type SC must use an approximation element ~[]E for V2 and V3 to > compile. > > 2. In the same section, the document should add a DoubleDefined2 function, > to > show the new syntax introduced in #48424. > > func DoubleDefined2(S ~[]E, E constraints.Integer) S { ... } > > > Thanks > Manlio > > > > On Wednesday, January 19, 2022 at 11:04:01 PM UTC+1 Ian Lance Taylor wrote: > >> On Wed, Jan 19, 2022 at 1:50 AM Manlio Perillo <manlio....@gmail.com> >> wrote: >> > >> > I'm reading the Type Parameter Proposal to learn how to use type >> parameters and I noted that one of the example in the "Element constraint >> example" section uses the >> > constraints.Number constraint. This constraint does not exist and >> probably should be replaced with constraints.Integer. >> >> Thanks, fixed. >> >> 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/6d877d71-9955-46bd-b5ff-98e71b79e4a3n%40googlegroups.com.