From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Functors and classes
Date: Tue, 3 Aug 2004 14:17:16 +0100 [thread overview]
Message-ID: <20040803131716.GA22773@annexia.org> (raw)
In-Reply-To: <20040803121049.GA22418@annexia.org>
OK, I have another problem.
My apache.mli now looks like this:
----------------------------------------------------------------------
module type DbiConnection = sig
class connection : ?host:string -> ?port:string ->
?user:string -> ?password:string -> string ->
object
method close : unit -> unit
method closed : bool
method ping : unit -> bool
method rollback : unit -> unit
end
end
module type DbiPoolT = sig
type connection
val get : Request.t -> ?host:string -> ?port:string ->
?user:string -> ?password:string -> string -> connection
end
module DbiPool (Dbi : DbiConnection) : DbiPoolT
with type connection = Dbi.connection
----------------------------------------------------------------------
This compiles fine, with the corresponding .ml file. However when
I try to instantiate a pool using:
module Pool = DbiPool (Dbi_postgres)
I get errors:
File "examples/useful-scripts/maillist.ml", line 49, characters 23-35:
Signature mismatch:
Modules do not match:
[...]
The public method commit cannot be hidden
The public method database cannot be hidden
The public method database_type cannot be hidden
[etc.]
I understand why this happens, because the actual Dbi_postgres.-
connection class is much more complicated than the mere four methods
which I need to use to make the pool work.
However, importing the entire class type is complex in three respects:
it depends on a bunch of other classes which need to be imported; and
it means that a particular version of mod_caml becomes very dependent
on a particular version of ocamldbi; and (crucially, fatally) the
different database subclasses may all contain extra and different
public methods, so there is no way to list all the public methods
anyway.
I tried to define an "open class" (<method; method; ..>) using:
module type DbiConnection = sig
class connection : ?host:string -> ?port:string ->
?user:string -> ?password:string -> string ->
< close : unit -> unit;
closed : bool;
ping : unit -> bool;
rollback : unit -> unit; .. >
end
but this gives a syntax error.
Ideas on how to solve this one?
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
NET::FTPSERVER is a full-featured, secure, configurable, database-backed
FTP server written in Perl: http://www.annexia.org/freeware/netftpserver/
-------------------
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:[~2004-08-03 13:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-03 12:02 Richard Jones
2004-08-03 12:10 ` Richard Jones
2004-08-03 13:17 ` Richard Jones [this message]
2004-08-03 15:06 ` John Prevost
2004-08-03 15:12 ` Richard Jones
2004-08-03 15:27 ` John Prevost
2004-08-03 15:28 ` John Prevost
2004-08-03 19:57 ` brogoff
2004-08-03 22:05 ` brogoff
2004-08-03 23:24 ` John Prevost
2004-08-03 15:50 ` Richard Jones
2004-08-03 16:23 ` John Prevost
2004-08-03 16:42 ` Richard Jones
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=20040803131716.GA22773@annexia.org \
--to=rich@annexia.org \
--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