From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Extending modules and signatures
Date: Sun, 19 Apr 2009 22:53:13 +0100 [thread overview]
Message-ID: <200904192253.13453.jon@ffconsultancy.com> (raw)
In-Reply-To: <d8be5ae20904191436y6e43fa10y6aa0ec6dc2bbdde8@mail.gmail.com>
On Sunday 19 April 2009 22:36:12 Ashish Agarwal wrote:
> > The module type exists, it's just that it doesn't have a name.
>
> Right, thanks for the clarification.
>
> > let x = (123, "abc")
> > does not define "type x = int * string" either.
>
> True, but I think the expectations are different for module types. A file
> a.ml creates a module named A, and it seems natural to expect a.mli to
> create a module type A. I find it inconsistent that it does not.
The mli and ml are equivalent to:
module A : sig =
...
end = struct
...
end
i.e. no module type is defined.
> Further, if you wanted to name the above type, it is easy, just write "type
> x = int * string". The corresponding solution to naming module types is
> burdensome. You have to define it within another module, introducing an
> unnecessary layer into your module hierarchy. Also that doesn't help you
> when using somebody else's library.
True. There is also an unfortunate amount of copy'n'paste involved as well,
and manual maintenance of signatures. I believe that often deters people from
using module signatures and module types at all.
> Having the compiler introduce module type names automatically from mli
> files would be very helpful, and I don't see any disadvantages.
Some people contest the idea that files should automatically convey module
information at all (SML does not). Indeed, should directories convey
something as well?
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
next prev parent reply other threads:[~2009-04-19 21:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-17 20:51 Peter Hawkins
2009-04-17 21:36 ` [Caml-list] " Goswin von Brederlow
2009-04-18 5:47 ` Ashish Agarwal
2009-04-18 14:20 ` Martin Jambon
2009-04-19 21:36 ` Ashish Agarwal
2009-04-19 21:53 ` Jon Harrop [this message]
2009-04-20 5:17 ` Goswin von Brederlow
2009-04-20 0:06 ` Martin Jambon
2009-04-20 5:23 ` Goswin von Brederlow
2009-04-20 11:55 ` Martin Jambon
2009-04-21 16:01 ` Ashish Agarwal
2009-04-17 21:30 Dario Teixeira
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=200904192253.13453.jon@ffconsultancy.com \
--to=jon@ffconsultancy.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