caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Restrictions on signature substitutions
@ 2013-06-24 16:49 Markus Mottl
  0 siblings, 0 replies; only message in thread
From: Markus Mottl @ 2013-06-24 16:49 UTC (permalink / raw)
  To: OCaml List

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-24 16:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-24 16:49 [Caml-list] Restrictions on signature substitutions Markus Mottl

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