Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <xleroy@pauillac.inria.fr>
To: fva@ing.uc3m.es
Cc: caml-list@pauillac.inria.fr
Subject: Re: Some questions about the module system...
Date: Wed, 24 Jul 1996 11:15:50 +0200 (MET DST)	[thread overview]
Message-ID: <199607240915.LAA22240@pauillac.inria.fr> (raw)
In-Reply-To: <9607221531.AA06681@elrond.uc3m.es> from "Francisco J. Valverde" at Jul 22, 96 05:19:49 pm


> 1) is there any reason (unclear semantics, scope-holing, etc.) why the O'Caml
> module system won't allow an "include <signature>" feature?

Actually, "include <signature>" is available in O'Caml as it was in
Caml Special Light. It was a last-minute addition that never got
documented, but since it causes no harm and seems to be useful, I'll
keep it and document it for the next release.

> b) My second question concerns module coercion by means of module signatures.
> Sharing constraints between module types is really necessary for code
> abstraction, but I found "value aliasing" really useful as well (I don't
> know the exact term for the feature so I will describe it).

The only coercions that can be performed with a signature constraint
(str : sig) are restrictions, i.e. hide components or make their type
info less precise. I doubt renaming of structure components has its
place there. But it's easy (and just as efficient) to do the coercion
yourself, e.g.:

  module Node = struct
    type node 
    let less_depth = ...
    let less_dist = ...
    ...
  end

  module DepthFirstPQueue =
    MakePQueue (struct type t = Node.node let leq = Node.less_depth end)

  module BestFirstPQueue =
    MakePQueue (struct type t = Node.node let leq = Node.less_dist end)

Regards,

- Xavier Leroy





  parent reply	other threads:[~1996-07-24 13:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-22 22:19 Francisco J. Valverde
1996-07-23 10:15 ` Wolfgang Lux
1996-07-24  9:15 ` Xavier Leroy [this message]
     [not found] <9607240936.AA07121@elrond.uc3m.es>
1996-07-24 11:32 ` Wolfgang Lux

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=199607240915.LAA22240@pauillac.inria.fr \
    --to=xleroy@pauillac.inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=fva@ing.uc3m.es \
    /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