Browse thread
[Caml-list] Re: OCAML Downcasting?
-
Jacques GARRIGUE
-
Damien Pous
-
Jacques GARRIGUE
-
skaller
- Jacques GARRIGUE
- Stefano Zacchiroli
-
skaller
-
Jacques GARRIGUE
- Michael Vanier
-
Damien Pous
[
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: | 2004-09-21 (09:50) |
From: | Jacques GARRIGUE <garrigue@k...> |
Subject: | Re: [Caml-list] Re: OCAML Downcasting? |
From: skaller <skaller@users.sourceforge.net> > On Tue, 2004-09-21 at 19:15, Jacques GARRIGUE wrote: > > > class ['a] button = object (self) > > inherit ['a] widget > > method raw = `Button (self :> 'a button) > > method press = prerr_endline "pressed" > > end > > > Without the self-cast, you cannot extend any class. > > Is that an issue with classes or polymorphic variants? With classes. If you omit the coercion, any class inheriting from button would have the type of the raw method specialized to itself, and as a result it would be incompatible with button. ... But strangely enough, some tests show that this is not the case. Even without the coercion, the type of `Button becomes fixed to 'a button. Looks like there is a bug in the interaction between classes and variants. So do not forget the coercion even if it works now without... Jacques Garrigue ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners