class material = object
method glow c = Printf.sprintf "highlighting with color %s" c
end ;;
class ['a] mesh (m : 'a) = object
constraint 'a = #material
val mutable material = m
method highlight = material#glow
end ;;
let m = new mesh (new material) ;;
m#highlight "blue" ;;
The above code works if constraint 'a = #material or constraint 'a = material.
Does the above constraint clause have the same meaning with or without β#β ?
if you use constraint 'a = #material but not if you use constraint 'a = material as the argument has an βextraβ method foo that does not appear in the signature of the class material.