Does Moonbit support type constraints?

It would be useful to implement the type-safe merge method of the heap.

type Ordered[T] class {
  Less(a: T, b: T) -> bool
}
type Heap[T: Ordered] struct {
// ...
}
2 个赞

We are working on something similar to this, that’s the last major missing feature before we reach the alpha status

5 个赞