[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Gert Smolka <smolka@p...> |
| Subject: | Overriding with subtypes |
It should be ok to override a method of type t with a method of a subtype of t. In fact, that happens in class c = object(self) method a = self end class c' = object(self) inherit c method a = self method b = 1 end since c' is a proper subtype of c. This is accepted by Ocaml. However, class d = object method a = new c end class d' = object inherit d method a = new c' end is rejected. Why? I would expect that this is a limitation that is due to the type inferencer. Gert Smolka