The only problem is the method concat
that is a pseudo-binary method.
There are two possible solutions. The first is not to make it a binary
method, and let the class be parametric:
| |
class ['a] ostring s = object (self)
val s = s
method repr = s
method concat (t:'a) = {< s = s ^ t # repr >}
end;; |
|
The second, more natural solution is to make concat a binary method by
making the parameter be the self-type.
| |
class ostring s = object (self : 'a)
val s = s
method repr = s
method concat (t:'a) = {< s = s ^ t # repr >}
end;; |
|