On Aug 20, 2020, at 20:27, Ian Lance Taylor <i...@golang.org> wrote: > > 1. > > We’re going to settle on square brackets for the generics syntax. > We’re going to drop the “type” keyword before type parameters, as > using square brackets is sufficient to distinguish the type parameter > list from the ordinary parameter list. To avoid the ambiguity with > array declarations, we will require that all type parameters provide a > constraint. This has the advantage of giving type parameter lists the > exact same syntax as ordinary parameter lists (other than using square > brackets). To simplify the common case of a type parameter that has > no constraints, we will introduce a new predeclared identifier “any” > as an alias for “interface{}”. > > The result is declarations that look like this: > > type Vector[T any] []T > func Print[T any](s []T) { … } > func Index[T comparable](s []T, e T) { … } > > We feel that the cost of the new predeclared identifier “any” is > outweighed by the simplification achieved by making all parameter > lists syntactically the same: as each regular parameter always has a > type, each type parameter always has a constraint (its meta-type). > > Changing “[type T]” to “[T any]” seems about equally readable and > saves one character. We’ll be able to streamline a lot of existing > code in the standard library and elsewhere by replacing “interface{}” > with “any”.
Resounding “yes” from me. I like this a lot. Good choice. The rest also sounds good (I think; I may be misunderstanding some of the bits about type switches but I think it sounds good), but #1 in particular should hopefully end the bikeshedding because it seems a good all-around compromise to me. - DavE -- 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/87B9E6D2-EC30-42A3-9E1F-FFA1942D9250%40gmail.com.