caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] include two module implementations sharing the same type definitions
@ 2018-11-29  8:52 Yann Régis-Gianas
  2018-11-29  9:02 ` Danny Gratzer
  0 siblings, 1 reply; 5+ messages in thread
From: Yann Régis-Gianas @ 2018-11-29  8:52 UTC (permalink / raw)
  To: Ocaml Mailing List

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

Dear OCaml module hackers,

the recently polished "substitution inside type signature" (described in
Sec 8.11 in the manual) is a real improvement to modularize module
signature developments.

Yet, it seems to me that "include" at the level of module implementations
is preventing us to unleash the full composability power of "include" at
the level of signature. Consider the following example:

``
module type A = sig type t end

module type B = sig type t end

type u = U

module AI : A with type t = u = struct
  type t = u
end

module BI : B with type t = u = struct
  type t = u
end

module ABI : sig
  include A
  include B with type t := t
end = struct
  include AI
  include BI (* This include unfortunately triggers:

Error: Multiple definition of the type name t.
       Names must be unique in a given structure or signature.

  *)
end
``

I have two questions:

Would it make sense to allow module implementation inclusion to introduce
multiple definitions of a given type name as long as these definitions are
equivalent?

Is there an idiom to work around this (apparent) limitation?

Cheers,
-- 
Yann Régis-Gianas

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list
Forum: https://discuss.ocaml.org/
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 1799 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-29  9:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29  8:52 [Caml-list] include two module implementations sharing the same type definitions Yann Régis-Gianas
2018-11-29  9:02 ` Danny Gratzer
2018-11-29  9:07   ` Yann Régis-Gianas
2018-11-29  9:08   ` Frédéric Bour
2018-11-29  9:12     ` Yann Régis-Gianas

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