Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Manuel Fahndrich <maf@microsoft.com>,
	"CAML List (E-mail)" <caml-list@inria.fr>
Subject: Re: Signature matching question?
Date: Fri, 19 Feb 1999 16:29:30 +0100	[thread overview]
Message-ID: <19990219162930.37090@pauillac.inria.fr> (raw)
In-Reply-To: <25983782061AD111B0800000F86310FE1026CAFD@RED-MSG-42>; from Manuel Fahndrich on Thu, Feb 11, 1999 at 05:47:39PM -0800

> I've run into the following problem with signature matching.
>
> module type FOO =
>   sig
>     type bar
>     module A : sig val fresh : unit -> bar end
>   end
> 
> module Foo : FOO =
>   struct
>     module A =
>       struct type t = {foo: int} let fresh () = {foo=1} end
>     type bar = A.t
>   end
>
> [... Signature mismatch ...]

> Is this intended behavior, or a bug? I would assume that within a module,
> delcarations are treated as an unordered set.

It is a bug.  The intent is, as you say, to perform signature matching
independently of the order of module components.  The typing rules
currently implemented get it right when there are only type and value
components, something is wrong with nested modules as in your example.

Indeed, your example type-checks when rewritten as follows:

> module Foo1 =
>   struct
>     module A =
>       struct type t = {foo: int} let fresh () = {foo=1} end
>     type bar = A.t
>   end
> module Foo : FOO = Foo1

The naming of the structure allows the type-checker to get its type
names right.

It's not obvious how to change the signature matching rules, though,
so I don't promise a quick fix.

- Xavier Leroy




      reply	other threads:[~1999-02-19 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-12  1:47 Manuel Fahndrich
1999-02-19 15:29 ` Xavier Leroy [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=19990219162930.37090@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=maf@microsoft.com \
    /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