From: Mathieu Barbin <mathieu.barbin@gmail.com>
To: Leo White <leo@lpw25.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Signature substitution deleting an exposed type alias
Date: Tue, 17 Mar 2015 22:00:38 -0400 [thread overview]
Message-ID: <CANXn40mH+GX7hR1Cy1RCeX294CN-_o34+1G1p_bEAKSYx9BfAg@mail.gmail.com> (raw)
In-Reply-To: <1425891008.3125906.237731925.21BB0F13@webmail.messagingengine.com>
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
Dear Leo, Thank you for the explanation and the illustrating example.
On Mon, Mar 9, 2015 at 4:50 AM, Leo White <leo@lpw25.net> wrote:
> > module type A = sig
> > type t = int
> > val of_int : int -> t
> > end
> >
> > module type B = sig
> > type t
> > include A with type t := t
> > end
> >
> > [...]
> >
> > In the example, I am not sure what exactly are the signatures involved
> in the comparison, since the included signature
> > does not contain the definition of the type t ( removed by the use of :=
> ), and without the type [t] the signature are
> > virtually identical.
>
> The two signatures being compared are the signatures before the
> definition of t is removed, so essentially:
>
> sig
> type t = int
> val of_int : int -> t
> end
>
> is being compared with:
>
> sig
> type t = t'
> val of_int : int -> t
> end
>
> where t' refers to the type defined by the `type t` definition in the B
> signature.
>
> This prevents inconsistent signatures being created. For example,
>
> type t = T of int
>
> module type C = sig
> type s = int
> type r = t = T of s
> end
>
> module type D = C with type s := float
>
> would result in:
>
> module type D = sig type r = t = T of float end
>
> which is inconsistent, since the definition does not match the equation.
>
> Regards,
>
> Leo
>
[-- Attachment #2: Type: text/html, Size: 2697 bytes --]
prev parent reply other threads:[~2015-03-18 2:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 22:46 Mathieu Barbin
2015-03-09 8:50 ` Leo White
2015-03-18 2:00 ` Mathieu Barbin [this message]
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=CANXn40mH+GX7hR1Cy1RCeX294CN-_o34+1G1p_bEAKSYx9BfAg@mail.gmail.com \
--to=mathieu.barbin@gmail.com \
--cc=caml-list@inria.fr \
--cc=leo@lpw25.net \
/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