caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Alain Frisch <Alain.Frisch@inria.fr>
Cc: Caml List <caml-list@inria.fr>
Subject: Modules for Dummies
Date: Sun, 18 Mar 2007 00:52:26 +1100	[thread overview]
Message-ID: <1174139546.21671.35.camel@rosella.wigram> (raw)
In-Reply-To: <45FBA365.5060700@inria.fr>

On Sat, 2007-03-17 at 09:14 +0100, Alain Frisch wrote:

[changed the title to something more appropriate]

> skaller wrote:
> > So actually, this F is distinct from Foo, even though all the
> > members are the same. In particular, if Foo has an abstract type t,
> > is F.t the same type as Foo.t?
> 
> Yes, because the signature inferred for F keeps a sharing constraint
> t = Foo.t. But if G is some functor with an abstract type s in the
> result, then G(F).s and G(Foo).s are not equal (because there is no
> sharing constraint between modules, such as F = Foo).

Hmm .. this is quite hard to understand.
So let's consider:

module F = Foo
module G = Foo

then F.t and G.t are also the same type because they both
have an inferred sharing constraint t = Foo.t, but F, G,
and Foo are distinct modules. Perhaps I could also write:

module Foo = struct type t = int end
module F = struct type t constraint t = Foo.t val x = 1 end
module G = struct type t constraint t = Foo.t val y = 2 end

to get the same sharing? but clearly Foo, F, G are distinct.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2007-03-17 13:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14 12:14 ocamlbuild and automatic dependencies Joel Reymont
2007-03-14 12:24 ` [Caml-list] " Nicolas Pouillard
2007-03-14 12:36   ` Joel Reymont
2007-03-14 12:43     ` Nicolas Pouillard
2007-03-14 12:47       ` Joel Reymont
2007-03-14 13:11         ` Nicolas Pouillard
2007-03-14 20:11           ` skaller
2007-03-14 20:57             ` Alain Frisch
2007-03-15  3:46               ` skaller
2007-03-16 14:00           ` Joel Reymont
2007-03-16 14:22             ` Daniel de Rauglaudre
2007-03-17  0:18               ` skaller
2007-03-17  3:01                 ` Daniel de Rauglaudre
2007-03-17  8:14                 ` Alain Frisch
2007-03-17 13:52                   ` skaller [this message]
2007-03-16 14:40             ` 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=1174139546.21671.35.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=Alain.Frisch@inria.fr \
    --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;
as well as URLs for NNTP newsgroup(s).