From: "Pierre CREGUT - FT . BD/CNET/DTL/MSV" <pierre.cregut@cnet.francetelecom.fr>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: Francois Pottier <Francois.Pottier@inria.fr>,
"Pierre CREGUT - FT . BD/CNET/DTL/MSV"
<pierre.cregut@cnet.francetelecom.fr>,
caml-list@inria.fr
Subject: Re: Parameterized signatures needed ?
Date: Fri, 17 Sep 1999 15:01:04 +0200 [thread overview]
Message-ID: <19990917150104.A4910@lsun605> (raw)
In-Reply-To: <19990916185939.24663@pauillac.inria.fr>; from Xavier Leroy on Thu, Sep 16, 1999 at 06:59:39PM +0200
> This looks less natural to me. A very limited form of "row
> polymorphism" can already be expressed with module type parameters and
> sub-structures, as in:
>
> module d(X:sig
> module type X
> module F(a:A) : sig
> module b: sig type t module M: X end
> module c:C with type t = b.t
> end
> end) : ...
>
> but it's very limited and not really practical.
>
Only because you cannot express sharing type constraints on M because X is
abstract. As it is written, you have
a module b with a type t and a contents that does not use it. You can
also write [module b : sig type t include X end]
but this does not solve the problem and it express more than you want.
All I would like to say is if there is a t used in X then it has to be
this C.t but I do not require t to exist. But the [with type] construct adds
that t must exist and must be immediately checkable.
So in fact there are two solutions :
- allow [X with type t = C.t] even if X is abstract and may not have a t
component : it means that if X is realized by a signature with
a type t then we add the constraint t = C.t
- X(t) (the solution proposed in my first post) : then the type does not need
to be named t in X(t) as we can say module type X(t) = sig type u = t end
The first solution is more limited but adds no syntax. It just requires a
special treatment of defered constraints for abstract signature when X
is given an actual value.
I am not sure it is strictly related with subtyping. It deals only with
the stamp calculus, not with the visibility of components.
--
Pierre Cregut - pierre.cregut@cnet.francetelecom.fr - +33 2 96 05 16 28
FT.CNET - DTL/MSV - 2 avenue Pierre Marzin - 22307 Lannion Cedex - France
prev parent reply other threads:[~1999-09-20 13:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-13 10:25 Pierre CREGUT - FT . BD/CNET/DTL/MSV
1999-09-14 9:46 ` Francois Pottier
1999-09-16 16:59 ` Xavier Leroy
1999-09-17 13:01 ` Pierre CREGUT - FT . BD/CNET/DTL/MSV [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=19990917150104.A4910@lsun605 \
--to=pierre.cregut@cnet.francetelecom.fr \
--cc=Francois.Pottier@inria.fr \
--cc=Xavier.Leroy@inria.fr \
--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