Closed dannypsnl closed 1 year ago
Great that you started to track the discussion @dannypsnl!
Just to clarify, we will evaluate how using generics would change the llir/llvm
API, and based on this evaluation of benefits and drawbacks, we would then decide whether to actually update the API to use generics or not. It is also a possibility that generics brings with it more cons than pros in our specific case. Experimentation and evaluation will tell! :)
Cheers, Robin
Just thinking, maybe https://github.com/llir/llvm/issues/59#issuecomment-993037757 is not hopeless now with Generic concept in Go(actually union part).
Previously, we must write
type Function interface {
// ...
}
var _ Function = &function{}
type function struct {
// ...
}
To let users have their own Function
, now we can have
type Function struct {
// ...
}
type Func interface {
LLString() string
// anything we need internally
}
// use point of Function
func foo[F *Function | Func](f F) {
// ...
}
Generic(a.k.a. parametric polymorphism) added into Go, let's explore how would it change our codebase, this issue is created to track related discussion.