caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Dave Berry" <Dave@kal.com>
To: "Hendrik Tews" <tews@tcs.inf.tu-dresden.de>, <caml-list@inria.fr>
Subject: RE: [Caml-list] recursive modules redux, & interface files
Date: Thu, 22 Mar 2001 18:04:24 -0000	[thread overview]
Message-ID: <DD7356599083414BA450E3DCC4119B8B04100D@NT.kal.com> (raw)

To be more general, perhaps specifications could be interleaved with
declarations in modules.  In addition to including entire structures,
this would let you specify the type of a function separately from it's
implementation:

val map: ('a -> 'b) -> 'a list -> 'b list
let rec map f l = 
  match ...

This is one aspect I like about Haskell's syntax.  I find it clearer
than the current:

let rec map (f: 'a -> 'b) (l: 'a list) =
  match ...

I prefer Hendrik's suggestion of explicitly including a signature to the
earlier suggestion of automatically including types from a signature
constraint.  If you automatically include types from a signature
constraint, the signature stops being a constraint, and you might match
signatures that you never intended to.

I assume Hendrik is considering the case where an interface already
exists, and you're writing the implementation.  Another case is where
you're writing a module without an explicit interface, but you want to
constrain just some of the external view.  Using specifications in the
module itself might help here too:

type coleur = Rouge | Vert | Bleu
(both type and implementation exported)

type animal
type animal = Chien | Chat | Oiseau
(only the type is visible outside the module)

I've no idea how easy or hard it would be to incorporate this into
either the semantics or the implementation of the language.  But from a
pragmatic point of view, it seems a relatively clean change.

Dave.


-----Original Message-----
From: Hendrik Tews [mailto:tews@tcs.inf.tu-dresden.de]
Sent: Thursday, March 22, 2001 12:03
To: caml-list@inria.fr
Subject: Re: [Caml-list] recursive modules redux, & interface files

What about changing
include, such that including a signature into a structure
includes all types and all exceptions?

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


             reply	other threads:[~2001-03-22 18:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-22 18:04 Dave Berry [this message]
2001-03-23  7:54 ` Tom Hirschowitz
2001-03-23 12:18   ` Fabrice Le Fessant
2001-03-27  8:49   ` Hendrik Tews
  -- strict thread matches above, loose matches on Subject: below --
2001-03-27 17:05 Manuel Fahndrich
2001-03-27 14:38 Don Syme
2001-03-23 20:33 Don Syme
2001-03-27  9:00 ` Xavier Leroy
2001-03-23 10:33 Dave Berry
2001-03-22 11:55 Dave Berry
2001-03-22 12:01 ` Markus Mottl
2001-03-27  6:29 ` John Max Skaller
2001-03-18 23:05 Chris Hecker
2001-03-19  0:01 ` Brian Rogoff
2001-03-19 11:04 ` John Max Skaller
2001-03-19 11:41   ` Chris Hecker
2001-03-20 17:43     ` John Max Skaller
2001-03-21  4:03       ` Chris Hecker
2001-03-21  5:10         ` Patrick M Doane
2001-03-21  9:27           ` Chris Hecker
2001-03-21 18:20           ` John Max Skaller
2001-03-22  0:03             ` Patrick M Doane
2001-03-22  0:22               ` Brian Rogoff
2001-03-22  9:11               ` Francois Pottier
2001-03-21 23:24           ` John Prevost
2001-03-22  0:00             ` Patrick M Doane
2001-03-21 18:18         ` John Max Skaller
2001-03-21 18:19         ` John Max Skaller
2001-03-22 11:40   ` Markus Mottl
2001-03-21 18:41 ` Xavier Leroy
2001-03-22  0:23   ` Patrick M Doane
2001-03-22 12:02   ` Hendrik Tews
2001-03-22 13:01     ` Markus Mottl
2001-03-22 16:56       ` Brian Rogoff
2001-03-22 17:13         ` Daniel de Rauglaudre
2001-03-23 17:30         ` Fergus Henderson
2001-03-23 18:04           ` Brian Rogoff
2001-03-26  2:29             ` Fergus Henderson
2001-03-27 22:11         ` John Max Skaller
2001-03-28  4:30           ` Brian Rogoff
2001-04-05 17:07             ` John Max Skaller
2001-03-27  8:21       ` Hendrik Tews

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=DD7356599083414BA450E3DCC4119B8B04100D@NT.kal.com \
    --to=dave@kal.com \
    --cc=caml-list@inria.fr \
    --cc=tews@tcs.inf.tu-dresden.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).