expr
expr copied to clipboard
Fetcher Interface
How exactly should this be implemented:
To fetch fields from struct, values from map, get by indexes expr uses reflect package. Envs can implement vm.Fetcher interface, to avoid use reflect:
type Fetcher interface {
Fetch(interface{}) interface{}
}
I mean considering the following struct .. how does one implement this optimization?
type foo struct {
i int,
f float64,
s string
}
Thank you.
Maybe this PR will answer https://github.com/antonmedv/expr/pull/254
Unexported fields cannot be accessed.