From: Benjamin Geer <ben@socialtools.net>
To: brogoff@speakeasy.net
Cc: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>,
"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] does class polymorphism need to be so complicated?
Date: Thu, 21 Aug 2003 21:20:08 +0100 [thread overview]
Message-ID: <3F452978.1040805@socialtools.net> (raw)
In-Reply-To: <Pine.LNX.4.44.0308211008560.22336-100000@grace.speakeasy.net>
brogoff@speakeasy.net wrote:
> I think the burden is very slight, but I have no problem at all with using
> functions outside of objects. Realistic implementations would provide
> coercion functions for every base class you want to coerce to, perhaps
> named something like "as_base_class_name". Using the exmaple you give in
> another message, we get something like this [...]
Thanks for the example; I think I can live with the approach you
propose. :) I agree with you (and Scott Meyers) about functions outside
of objects being a good thing, as long as they're doing something
useful, and not just working around syntactical problems. Or at least
as long as I don't have to write a large number of them. With the
approach you suggest, it looks like I only need one coercion function
per base class, which I agree isn't too burdensome:
> let as_connection o = (o : #connection :> connection);;
I'm still curious to know why the example I gave (returning a
mysql_connection from a method that was typed to return a #connection)
didn't compile, though ("This method has type string -> mysql_connection
which is less general than 'a. string -> (#connection as 'a)").
Ben
-------------------
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:[~2003-08-21 20:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-20 15:42 Benjamin Geer
2003-08-20 16:05 ` Brian Hurt
2003-08-20 16:19 ` Richard Jones
2003-08-20 16:25 ` Benjamin Geer
2003-08-20 17:09 ` brogoff
2003-08-20 17:25 ` Jacques Carette
2003-08-20 23:34 ` Jacques Garrigue
2003-08-21 13:27 ` Jacques Carette
2003-08-20 18:19 ` Benjamin Geer
2003-08-20 20:39 ` brogoff
2003-08-20 21:04 ` Benjamin Geer
2003-08-21 0:28 ` Jacques Garrigue
2003-08-21 8:17 ` Benjamin Geer
2003-08-21 8:58 ` Jacques Garrigue
2003-08-21 9:38 ` Benjamin Geer
2003-08-21 11:44 ` Remi Vanicat
2003-08-21 13:11 ` Richard Jones
2003-08-21 16:41 ` Remi Vanicat
2003-08-21 18:04 ` brogoff
2003-08-21 20:20 ` Benjamin Geer [this message]
2003-08-21 23:35 ` Benjamin Geer
2003-08-22 3:59 ` Jacques Garrigue
2003-08-22 7:12 ` Benjamin Geer
2003-08-21 13:38 ` Benjamin Geer
2003-08-21 0:58 ` brogoff
2003-08-20 23:40 ` Benjamin Geer
2003-08-21 1:29 ` Jacques Garrigue
2003-08-21 9:19 ` Benjamin Geer
2003-08-21 18:44 ` Chris Clearwater
2003-08-20 20:43 ` Issac Trotts
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=3F452978.1040805@socialtools.net \
--to=ben@socialtools.net \
--cc=brogoff@speakeasy.net \
--cc=caml-list@inria.fr \
--cc=garrigue@kurims.kyoto-u.ac.jp \
/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