Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: William Lovas <wlovas@stwing.upenn.edu>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] How to use Set Datatype
Date: Sat, 11 Dec 2004 21:46:37 -0500	[thread overview]
Message-ID: <20041212024637.GA11860@force.stwing.upenn.edu> (raw)
In-Reply-To: <1102809942.2611.647.camel@pelican.wigram>

On Sun, Dec 12, 2004 at 11:05:42AM +1100, skaller wrote:
> On Sun, 2004-12-12 at 08:12, Brian Hurt wrote:
> > On Fri, 10 Dec 2004, Micha wrote:
> 
> > Another thing- longtime Ocaml programmers tend to inline their structure 
> > definitions.  
> 
> Why? Because binding implicitly by name is basically bogus?

What do you mean by bogus?  And what do you mean by "binding implicitly by
name"?

I think experienced O'Caml programmers simply prefer to save the step of
binding, especially if module you're passing as the argument to a functor
is never used elsewhere.

> So you write
> 
> 	Set.Make(struct let compare=String.compare ...
> 
> because the name in the functor 'compare' only agrees
> accidentally. The anonymous struct there seems general,
> and at least exposes explicitly the bindings.

There's nothing "accidental" about it -- there is a very precise sense in
which some modules are appropriate as input to the Set.Make functor, namely
that they have the signature Set.OrderedType.  This is just as precise as
saying that 3 is appropriate as an argument to (+) while "hello" is not.

O'Caml's module system is not some arbitrary hack -- it has a very rich and
elegant type theoretic foundation.

William


  reply	other threads:[~2004-12-12  2:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-10 18:37 Jan Stamer
2004-12-10 19:44 ` [Caml-list] " Micha
2004-12-11  1:33   ` Jon Harrop
2004-12-11 21:12   ` Brian Hurt
2004-12-12  0:05     ` skaller
2004-12-12  2:46       ` William Lovas [this message]
2004-12-12  3:09       ` Brian Hurt

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=20041212024637.GA11860@force.stwing.upenn.edu \
    --to=wlovas@stwing.upenn.edu \
    --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