[
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: | Brian Smith <brian-l-smith@u...> |
| Subject: | Re: [Caml-list] polymorphic methods |
Jacques Garrigue wrote:
>
> Sorry, but there is no handling of instanciation via subtyping.
> Currently subtyping and instanciation are orthogonal concepts: you
> cannot subtype in an .mli, and you cannot instanciate an
> explicitly polymorphic type when subtyping.
> I believe it's correct, but you won't make me write the code without a
> proof :-)
That is really an interesting comment. I wonder, what are people
currently researching w.r.t. the object-oriented features of O'Caml?
Besides the above, Jacques said that recursive types with classes is not
completely defined because (paraphrasing) recursive types are
polymorphic and recursive classes are monomorphic:
type variant = Node of node
and
class node =
object
method as_variant : variant = Node self
end
I wonder, does a similar problem apply to recursive exceptions and classes?:
(* email me for a complete example *)
exception NotFound of node
and
class node =
object
method find x = ... else raise (NotFound self)
end;;
And, similarly, it does seem odd that currently it is impossible to
create a polymorphic method equivalent to "map" (This type of problem is
mentioned in http://citeseer.nj.nec.com/remy98objective.html).
Besides polymorphism, I wonder if it is possible to add open classes and
multiple dispatch to O'Caml like MultiJava does for Java
(http://www.cs.iastate.edu/~cclifton/multijava/).
I'm just a beginner and I don't know any of the theory of this yet, so
i'm hoping somebody else will give Jacques some proofs of solutions to
the above :)
Thanks,
Brian
-------------------
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