expr icon indicating copy to clipboard operation
expr copied to clipboard

Fetcher Interface

Open seekerkoruth opened this issue 4 years ago • 1 comments

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.

seekerkoruth avatar Sep 18 '21 22:09 seekerkoruth

Maybe this PR will answer https://github.com/antonmedv/expr/pull/254

nidorx avatar Sep 03 '22 01:09 nidorx

Unexported fields cannot be accessed.

antonmedv avatar Nov 05 '22 19:11 antonmedv