Hi,
Following the blog post <https://blog.golang.org/why-generics>about
generics in Go, I want to join Ian about his claim to "Minimize new
concepts".
Would it be possible to allow a syntax that just omits a type constraint in
the generic function definition instead of using  any ? Then the following
syntax will be valid:
func F[T1, T2 Constraint](p1 T1, p2 T2) { ... }

And will define a function F with two generics T1 and T2 where T1 has no
constraints and T2 has a constraint described by the Constraint interface.
If it complicates the syntax, would it be possible to reuse blank
identifier syntax. The same function will look like:
func F[T1 _, T2 Constraint](p1 T1, p2 T2) { ... }

The goal is just to avoid introducing another predeclared name. Basically,
any is a predefined declaration of the empty interface:
type any interface { }

I think adding it contradicts the main goals of Golang. Will be happy to
hear your opinion about it.

Thank you,
        minherz
---------------------------------------------------------
I declare that I operate by "Crocker's Rules
<http://www.sl4.org/crocker.html>"

-- 
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/CALuHfSO%3DKALbaQehDUXW3uq3yCE0Bw4vgVT_J8KNQc9PExPg1g%40mail.gmail.com.

Reply via email to