From: Brian Smith <brian-l-smith@uiowa.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] polymorphic methods
Date: Sun, 14 Jul 2002 21:08:12 -0500 [thread overview]
Message-ID: <3D322E8C.8010402@uiowa.edu> (raw)
In-Reply-To: <20020715100504O.garrigue@kurims.kyoto-u.ac.jp>
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
next prev parent reply other threads:[~2002-07-15 2:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-14 23:16 nadji
2002-07-15 1:05 ` Jacques Garrigue
2002-07-15 2:08 ` Brian Smith [this message]
2002-07-15 16:24 ` nadji
-- strict thread matches above, loose matches on Subject: below --
2015-12-18 9:18 Christoph Höger
2015-12-18 10:07 ` Leo White
2003-03-12 23:07 Damien
2003-03-13 0:56 ` brogoff
2003-03-13 1:56 ` Jacques Garrigue
2003-03-13 9:04 ` Damien
2003-03-13 9:27 ` Jacques Garrigue
2003-03-13 14:49 ` Damien
2003-03-13 9:41 ` Olivier Andrieu
2002-08-23 15:46 [Caml-list] Polymorphic methods Frederic Tronel
2002-08-23 17:32 ` Fred Smith
2002-08-23 18:21 ` Remi VANICAT
2001-11-19 15:29 Alain Frisch
2001-11-20 0:29 ` Jacques Garrigue
2001-11-20 9:33 ` Alain Frisch
2001-11-20 20:55 ` Xavier Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D322E8C.8010402@uiowa.edu \
--to=brian-l-smith@uiowa.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox