caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: julien.signoles@cea.fr
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] generalization and let module
Date: Fri, 22 Jun 2007 09:32:56 +0900 (JST)	[thread overview]
Message-ID: <20070622.093256.102578198.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <1182439513.19841.88.camel@localhost>

From: Julien SIGNOLES <julien.signoles@cea.fr>

> Just a single question: why is 'f' not generalizable in the following
> example? I'm not able to find an example using any "let module" and
> breaking the type safety.
> 
> =====
> module M = struct end
> let f = let module N = M in fun x -> x
> =====

What about

let f =
  let module M = struct let x = ref [] end in
  fun x -> let y = List.hd !M.x in M.x := [x]; y ;;

Making this function polymorphic would clearly be unsound.
However, you're right on one account: this can only happen with
structures, but not with module aliasing, or even functor application.
So the non-expansiveness check could be refined.

Jacques Garrigue


      reply	other threads:[~2007-06-22  0:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-21 15:25 Julien SIGNOLES
2007-06-22  0:32 ` Jacques Garrigue [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=20070622.093256.102578198.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@yquem.inria.fr \
    --cc=julien.signoles@cea.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).