TropicSapling/triforce

Go2-style generics?

Opened this issue · 0 comments

“In order to express constraints on the types, Go2 suggests “contracts” which is basically a set of expressions that a generic type would need to fulfill:

contract stringer(x T) {
    var s string = x.String()
}

Basically the above example says that a generic type fulfilling “stringer” should be able to correctly compile inside the braces.” - Christoffer Lernö on Medium