gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent behavior w/ reflect.TypeOf

icncsx opened this issue · comments

type T string

t := T("what")
tt := reflect.TypeOf(t)
fmt.Println(tt) // prints string, should be main.T

This is a known limitation:
Go standard library does not provide any way to create new named types at runtime - only new unnamed types can be created.

Thus it's currently not possible to fix this issue.

There is an open enhancement proposal golang/go#39717 for adding such feature to Go standard library - I started implementing it some months ago, but it's still unfinished