Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "John F. Hughes" <jfh@cs.brown.edu>
To: <caml-list@inria.fr>
Subject: Questions on modules
Date: Fri, 19 Nov 2004 22:34:32 -0500	[thread overview]
Message-ID: <20041120033427.HHDG8344.lakermmtao12.cox.net@SPIKESHOMEPC> (raw)


I'm trying to make sense of the module language; I find that there
are useful analogies with the "value language" (where there are 
variables, functions, etc.) It appears that the following are 
reasonable: 

1. "module" has a meaning corresponding to "let"; I see

let x = 5;;

and

module T = struct
  type t = int
  let c = 1
end;;

as analogous -- both establish bindings for names, more or less. 

2. types and signatures are less strongly analogous, because "having a
certain
type" is more restrictive than "matching a signature", but still,
"module type" 
seems to be analogous to "type". 

let x:int = 5;;

module type FOO = sig type t end;;

and

module T:FOO = struct
  type t = int
  let c = 1
end;;

seem analogous as well. 

But I'm allowed to write

let (x:int) = 5

and *not* allowed to write 

module (T:FOO) = struct
  type t = int
  let c = 1
end;;

----
Can someone give me a reason for this design decision? 

I appreciate your help...

--John Hughes



                 reply	other threads:[~2004-11-20  3:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041120033427.HHDG8344.lakermmtao12.cox.net@SPIKESHOMEPC \
    --to=jfh@cs.brown.edu \
    --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