Package level generics may look less confusing.
package abc(Key,Value)
contract CompileCheck(a1 Key, a2 Value) {
//...
}
type Pair struct {
K Key
V Value
}
func NewPair(k Key, v Value) Pair {
return Pair{K: k, V: v}
}
package xyz
import "abc(int32,float32)" myabc
func newPair() myabc.Pair {
return myabc.NewPair(1, 1.0)
}
Introduce two step compilation. Firstly create abc[Key,Value].lib from source. Then create abc(int32,float32).a from abc[Key,Value].lib . Both abc[Key,Value].lib and abc(int32,float32).a can be saved to reduce next compilation time.
Support the idea of package-level generics.
It keeps the code clean and simple, unlike to C++ generics where you have to type in plenty of places making code a mess.
It also allows to keep call traces readable, by adding types to file names, rather then functions (which are long lines already).