traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
7.02k stars 348 forks source link

Feature request: support generic package #1601

Open ahuigo opened 9 months ago

ahuigo commented 9 months ago

Proposal

Support generic package. Is it possible?

Background

It would be nice to use this famous generic package "github.com/samber/lo"

Workarounds

I find that yaegi doesn't support generic package. The following code shows an error: reflect lo.Assign failed: cannot infer K

$ ./bin/extract github.com/samber/lo
$ cat go1_21_github.com_samber_lo.go
package pkg

import (
    "github.com/samber/lo"
    "reflect"
)

func init() {
    Symbols["github.com/samber/lo/lo"] = map[string]reflect.Value{
        "Assign": reflect.ValueOf(lo.Assign),
....