tmp var in generic func?

76 views
Skip to first unread message

xie cui

unread,
Mar 19, 2021, 9:24:15 AM3/19/21
to golang-nuts
code:
func printvar[T any](){
    var t T
    fmt.Println("T", t)
}

printvar[int]()

the function  instantiate in cmd/compile will instantiate a generic func,
func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslist []syntax.Pos) (res Type)

but i look into the implement, i could not find the instantiate of temp var in generic func, just lkie var t T  up there.

i do find the instantiate of recieiver, param, result. so where is the instantiate of tmp var?

Ian Lance Taylor

unread,
Mar 19, 2021, 1:27:39 PM3/19/21
to xie cui, golang-nuts
This code is under active development and is regularly changing. If
you want to participate, I recommend that you read and comment on the
patches, which are all sent to golang-codereviews. I don't think it
will be helpful for the developers to spend time discussing how this
code works while it is under development and being regularly changed.
Thanks.

Ian
Reply all
Reply to author
Forward
0 new messages