I came across this too:
https://groups.google.com/g/golang-nuts/c/YJiS4eGLVdk/m/dPyqd0EMAQAJ

You can think of the declaration as being like this:

func (h *holder[alpha any]) processAlpha()

(although this is not valid syntax today). The name "alpha" gets bound to 
some type parameter in local scope, so it is unrelated to the "alpha" which 
exists outside. You can even shadow names like "string" and "int" in Go, if 
you want to write really confusing code.

I'm not sure if what you were trying to do is something like this:

type T = *holder[alpha]

func (h T) processAlpha() {
item := alpha(0.1)
_ = item.validate()
}

If so, that's not allowed:

./prog.go:28:9: cannot define new methods on instantiated type 
holder[alpha] 


-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/36283eac-9d43-47f9-9dab-a02b6443434en%40googlegroups.com.

Reply via email to