caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Leo White <leo@lpw25.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Signature substitution deleting an exposed type alias
Date: Mon, 09 Mar 2015 01:50:08 -0700	[thread overview]
Message-ID: <1425891008.3125906.237731925.21BB0F13@webmail.messagingengine.com> (raw)
In-Reply-To: <CANXn40ni9fAHLxJG3rpm+=yE8-jAQ-N=NyT_qTVQwSLwRrF84Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]


> 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: 2305 bytes --]

  reply	other threads:[~2015-03-09  8:50 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 [this message]
2015-03-18  2:00   ` Mathieu Barbin

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=1425891008.3125906.237731925.21BB0F13@webmail.messagingengine.com \
    --to=leo@lpw25.net \
    --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).