caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Manuel Fahndrich <maf@microsoft.com>
To: "'Markus Mottl'" <mottl@miss.wu-wien.ac.at>
Cc: caml-list@inria.fr
Subject: RE: additions to standard library?
Date: Fri, 10 Mar 2000 09:55:14 -0800	[thread overview]
Message-ID: <783D93998201D311B0CF00805FEAA07B7E915E@RED-MSG-42> (raw)


The issue you are raising is a good one. SML/NJ can handle some of it,
because the semantics of "open" are different there. Once can actually say:

	module Foo = struct
        open B
      end

and obtain a copy of B within Foo.

This might even work to extend functors as in:

	functor Foo(Arg : A) =
        struct
           module B = Bar(A)
           open B
           let extensions = ...
        end


However, this interpretation of "open" has impacts on compilation
dependencies, in particular scoping analysis (See e.g.  "Dependency analysis
for Standard ML; Matthias Blume; ACM Trans. Program. Lang. Syst. 21, 4 (Jul.
1999), Pages 790 - 812").

-Manuel



-----Original Message-----
From: Markus Mottl [mailto:mottl@miss.wu-wien.ac.at]
Sent: Friday, March 10, 2000 12:04 AM
To: caml-redistribution@pauillac.inria.fr
Cc: caml-list@inria.fr
Subject: Re: additions to standard library?


> But  when  using functorial  interfaces  like  Set.Make,  you have  to
> redefine these  functions for each  application of the  functor. Thus,
> you  really need these  functions to  be defined  in the  functor i.e.
> together with the datatype (and, by the way, you can then define these
> functions a bit more efficiently---without using exceptions).

Exactly - this raises another question which has been bothering me from
time to time when using the module system:

How can you extend the functionality of a module without having to "copy"
the definitions of the underlying module "by hand"? In a case which I found
particularly ugly (in the "res"-library), I had to "copy" nearly 100 lines
as in:

  module Foo = struct
    module B = ...
    type t = B.t
    ...
    let iter = B.iter
    let iteri = B.iteri
    let map = B.map
    let mapi = B.mapi
    ...
  end

Everytime the other module gets extended, I have to add code by hand here,
too, to make it available. I do not see any simple workaround for this.
Extending standard libraries with needed functionality would be much easier
if there were a convenient way to get around the problem above.

Regards,
Markus Mottl

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl



             reply	other threads:[~2000-03-10 18:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-10 17:55 Manuel Fahndrich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-03-21 21:43 Don Syme
2000-03-14 17:24 Don Syme
2000-03-21 21:08 ` John Max Skaller
2000-03-07 15:24 Markus Mottl
2000-03-08 19:03 ` Jean-Christophe Filliatre
2000-03-08 22:29   ` Markus Mottl
2000-03-10 10:51     ` Christian RINDERKNECHT
2000-03-09 13:18 ` Thorsten Ohl
2000-03-10 10:04   ` Francisco Valverde Albacete
2000-03-10 20:33     ` Markus Mottl
2000-03-14 23:15       ` Max Skaller
2000-03-11 18:49     ` Brian Rogoff
2000-03-12  1:54 ` Jerome Vouillon
     [not found]   ` <200003120239.DAA18581@miss.wu-wien.ac.at>
2000-03-14 17:53     ` Pierre Weis

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=783D93998201D311B0CF00805FEAA07B7E915E@RED-MSG-42 \
    --to=maf@microsoft.com \
    --cc=caml-list@inria.fr \
    --cc=mottl@miss.wu-wien.ac.at \
    /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).