From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Juan Jose Garcia Ripoll <jjgarcia@ind-cr.uclm.es>,
Caml list <caml-list@inria.fr>
Subject: Re: Some questions about signatures
Date: Tue, 27 Apr 1999 21:47:01 +0200 [thread overview]
Message-ID: <19990427214701.49448@pauillac.inria.fr> (raw)
In-Reply-To: <37144581.87032AC2@ind-cr.uclm.es>; from Juan Jose Garcia Ripoll on Wed, Apr 14, 1999 at 09:36:33AM +0200
> 1) Are OCaml's signatures opaque? I mean if they do hide the real
> implementation of data types and of non-declared values to the public, much
> like SML's :>
Yes, they are. OCaml's ": SIG" construct behaves like ":> SIG" in
SML'97.
> 2) How can I extend a signature with new values and types? I've been
> using the 'include' directive, but I did not find it in the
> manual. Is this supposed to work or is it just a Caml-Light
> reminiscent.
No, it's an oversight in the manual. "include" in signatures was
originally an experimental feature, but it seems useful enough that it
will stay. I'll fix the manual.
> 3) What is the simplest way to build toplevel modules using
> functors? In SML everything on every file is bound to the toplevel
> environment and one can do just 'structure NewStruct =
> AFunctor(structure A = AParameter)' to get a brand new module. But
> in OCaml toplevel modules are defined in term of two files (mli/ml)
> so what are my options if I dont want to add a spurious path name?
Currently, you must put your functors inside toplevel structures,
which are then mapped to .ml/.mli files. So, continuing your example
above, you have to write
module NewStruct = ModA.Functor(AParameter)
or
open ModA
module NewStruct = Functor(AParameter)
One could imagine having compilation units that can be functors by
themselves. It's mostly a problem of syntax: currently, the contents
of an implementation file (.ml) are systematically taken to be the
inside of a "module X = struct ... end" declaration; extending this
to functors would require special syntax for the parameters.
Regards,
- Xavier Leroy
prev parent reply other threads:[~1999-04-29 13:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-14 7:36 Juan Jose Garcia Ripoll
1999-04-27 19:47 ` Xavier Leroy [this message]
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=19990427214701.49448@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=jjgarcia@ind-cr.uclm.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