caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: Andreas Rossberg <rossberg@ps.uni-sb.de>
Cc: ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Renaming structures during inclusions?
Date: Wed, 11 May 2005 14:02:37 -0400	[thread overview]
Message-ID: <f8560b805051111025e5c04de@mail.gmail.com> (raw)
In-Reply-To: <42823CDF.3060109@ps.uni-sb.de>

On 5/11/05, Andreas Rossberg <rossberg@ps.uni-sb.de> wrote:
> Note that OCaml's type system fundamentally relies on the fact that type
> names cannot be shadowed in structures.

Hm, I don't see why this should be so, can you elaborate? I don't know
the compiler internals about type inference, this seems like a
question of how types are identified internally. I make the reasonable
guess that it is not by names (strings) but some kind of integer id or
similar. So "type t type t" could internally still be kept apart,
though producing error messages is a problem (would require printing
of extra tags), and the user could not refer to the shadowed type
anymore. That's why I wouldn't want the compiler to accept this code,
which is the current behaviour anyway.

> While your proposal probably could be made to work in this particular
> case - the compiler had to figure out that it can break the dependency
> on the first t by reordering m1_t relative to the fields from M1 in the
> derived signature and substituting m1_t for t in these fields, likewise
> for the other elements - it is *far* from obvious if and how this can be
> inferred in general, particularly when your modules go higher-order.

Maybe I don't see the problem, but since I feel confident that I can
always solve this problem manually in a fairly mechanized and
straightforward way, I'd be surprised if this couldn't be done by the
compiler. Isn't it just a normal alpha conversion problem? The only
thing that needs to be guaranteed by the compiler is that there is no
name capture, but that, too, isn't difficult to do.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


  reply	other threads:[~2005-05-11 18:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-11 15:44 Markus Mottl
2005-05-11 16:33 ` [Caml-list] " Christophe TROESTLER
2005-05-11 17:11   ` Andreas Rossberg
2005-05-11 18:02     ` Markus Mottl [this message]
2005-05-12 14:24       ` Andreas Rossberg
2005-05-11 18:16     ` Christophe TROESTLER
2005-05-12  1:24 ` Jacques Garrigue
     [not found]   ` <f8560b80505120836681ab281@mail.gmail.com>
2005-05-12 17:09     ` Markus Mottl
2005-05-12 15:26 ` Norman Ramsey
2005-05-12 20:02 ` Aleksey Nogin

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=f8560b805051111025e5c04de@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=rossberg@ps.uni-sb.de \
    /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).