caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matt Gushee <mgushee@havenrock.com>
To: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] functors and objects'
Date: Tue, 3 Feb 2004 12:39:59 -0700	[thread overview]
Message-ID: <20040203193958.GA9048@swordfish> (raw)
In-Reply-To: <20040203190635.6cc61ff0.Damien.Pous@ens-lyon.fr>

On Tue, Feb 03, 2004 at 07:06:35PM +0100, Damien wrote:
> 
> I would like to write something like
> 
> <<
> class type o = 
> object 
> 	method react: unit
> end
> 
> module type O = 
> sig
> 	type t :> o (* sigh... *)
> end

The first problem is that you're mixing type declarations and class
casts ... not a hard mistake to make, since the class cast syntax is a
bit confusing, and doesn't seem to be explained very well anywhere.
Anyway, you seem to have missed the simplest solution:

  module type O =
    sig
      type t = o
    end


> module R(M: O') = 
> struct
> 	include R(M)

I don't see how this can work, because this module R takes an argument
of type O', whereas the other R (do you really want to give them the
same name?) takes an argument of type O. Regardless of their contents,
they are different interfaces and thus not interchangeable. There's
undoubtedly a way to achieve the result you want, but I don't really
understand what you are trying to do. Do you actually have a specific
goal in mind, or are you just experimenting?

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
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


  parent reply	other threads:[~2004-02-03 19:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-03 18:06 [Caml-list] functors and objects Damien
2004-02-03 19:37 ` Matt Gushee
2004-02-03 19:39 ` Matt Gushee [this message]
2004-02-03 20:26   ` [Caml-list] functors and objects' Damien Pous
2004-02-04  2:57 ` [Caml-list] functors and objects Jacques Garrigue
2004-02-05  8:55   ` Damien
2004-02-05  9:18     ` Jacques Garrigue
2004-02-05 13:45       ` Damien
2004-02-06  1:30         ` Jacques Garrigue

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=20040203193958.GA9048@swordfish \
    --to=mgushee@havenrock.com \
    --cc=caml-list@pauillac.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;
as well as URLs for NNTP newsgroup(s).