caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: OCaml List <caml-list@yquem.inria.fr>
Subject: [Caml-list] Restrictions on signature substitutions
Date: Mon, 24 Jun 2013 12:49:58 -0400	[thread overview]
Message-ID: <CAP_800qe=n6uSDoNnFsF6siJumntQVkhrEBTT=pUM_DNJW+5tg@mail.gmail.com> (raw)

What's actually the deeper reason why the following is rejected:

  module type S = sig type t end
  module type T = S with type t := int list

Error message:

  Error: Only type constructors with identical parameters can be substituted.

I found this restriction quite annoying on multiple occasions.  At
first sight it seems easy to just introduce a workaround "type foo =
int list" and then substitute "foo".  But if the above definitions are
themselves part of a signature, this would require polluting the
containing signature with a new type or come up with more convoluted
solutions.

I suspect it's merely hard to support the above in the current type
system implementation, probably for a similar reason why substitutions
in sub-modules are disallowed.  Or is there some more fundamental
reason why this cannot be supported?

Regards,
Markus

--
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com

                 reply	other threads:[~2013-06-24 16:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAP_800qe=n6uSDoNnFsF6siJumntQVkhrEBTT=pUM_DNJW+5tg@mail.gmail.com' \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@yquem.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).