Can I write constraints that refer to generic types only?


#1

Is it possible to write constraints in the form of

class ['a, 'b] mytype = 
        object(self: 'self)
        constraint 'a = #'b

that is 'a shall be of interface of 'b


#2

No: when a new class is defined

class ['a] c = object method m = 0 end

the type 'a #c is defined along the class c and the type 'a c as an helper type. However, there is not such associated type for a generic type 'b, thus #'b is meaningless.