rbs
rbs copied to clipboard
Constraints on variables
It seems that currently the grammar only supports type constraints in the case of module declarations. It would be very useful to be able to constrain type variables, e.g. to require a particular interface.
For example:
interface _Comparable
def <=>: (untyped other) -> Integer | nil
end
class Heap[Elem : _Comparable]
def add: (Elem) -> void
end