caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Hongbo Zhang <bobzhang1988@gmail.com>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] First Class modules -A bug in 4.00?
Date: Fri, 8 Jun 2012 12:22:17 +0900	[thread overview]
Message-ID: <8D5E880B-79AC-45E1-B866-B83C3D725E36@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <4FD164E2.4050807@gmail.com>

On 2012/06/08, at 11:35, Hongbo Zhang wrote:

> Hi, List
>  I am not sure this is a bug or not?
> 
>  Below is a contrived example:
> ------------------
>  module type S = sig
>    type t=int
>    module  X : sig type u   end
>  end
> 
>  let f ( module X : S)  (y:X.X.u) =
>  3
> --------------------
> Error: This pattern matches values of type X.X.u
>      but a pattern was expected which matches values of type X.X.u
>      The type constructor X.X.u would escape its scope
> -- Thanks

Definitely, this is not a bug.
Type X.X.u is abstract, and showing it outside (as by taking an argument
of that type) would be meaningless.

What you might have meant is:

 let f (type a) (module X : S with type X.u = a) (y : X.X.u) = 3

This is typable (but I'm not sure it means anything...)

Jacques Garrigue

  reply	other threads:[~2012-06-08  3:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08  2:35 Hongbo Zhang
2012-06-08  3:22 ` Jacques Garrigue [this message]
2012-06-08 15:25   ` bob zhang
2012-06-08 15:29     ` bob zhang
2012-06-08 20:25   ` Milan Stanojević
2012-06-10  9:27     ` Jacques Garrigue

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=8D5E880B-79AC-45E1-B866-B83C3D725E36@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=bobzhang1988@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).