From: "Yaron M. Minsky" <yminsky@cs.cornell.edu>
To: Remi VANICAT <vanicat@labri.u-bordeaux.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Functorizing large collections of modules
Date: 18 Mar 2002 07:19:41 -0500 [thread overview]
Message-ID: <1016453982.27588.53.camel@dragonfly.localdomain> (raw)
In-Reply-To: <87vgbu2qsd.dlv@wanadoo.fr>
The problem, I think, with the solution listed below is that I don't see
how Bar can refer to Foo easily. In particular, it seems like every
time Foo.Make(ZZp) references Bar, it really needs to refrence
Bar.Make(ZZp). And come to think of it, I don't know how to do this at
all, since (I think) every invocation of Bar.Make(ZZp) creates an
independent instance of the module.
In particular, imagine Foo needs to reference Bar. Without functors,
the files might look something like this:
foo.ml:
let _ = Bar.snoo (ZZp.snip ())
bar.ml:
let open = ZZp.bark () + ZZp.flip ()
Now, with functors, how would this work?
foo.ml:
module M(ZZp:ZZpSig) =
struct
module Bar = Bar.M(ZZp)
let _ = Bar.snoo (ZZp.snip ())
end
bar.ml:
module M(ZZp:ZZpSig) =
struct
let open = ZZp.bark () + ZZp.flip ()
end
So now foo can refrence bar. But if there's a different module that
wants to look at bar also, it will end up referencing a different
instance of Bar.M(ZZp), which seems problematic.
So now I'm more confused than ever.
y
On Mon, 2002-03-18 at 04:01, Remi VANICAT wrote:
> "Yaron M. Minsky" <yminsky@cs.cornell.edu> writes:
>
> > This seems messy and kind of silly. Conceptually what I want is a
> > single structure like this:
> >
> > module Library(ZZp:ZZpSig) =
> > struct
> >
> > module Foo =
> > struct ... end
> >
> > module Bar =
> > struct ... end
> >
> > ...
> >
> > end
> >
> > That way, all the interior modules (Foo, Bar) get to reference the same
> > ZZp, without having to functorize the individual modules. So, what I'd
> > like is to be able to do this without sticking the modules Foo and Bar
> > into the same single large unmanageable file.
>
> you can call the functor in a bigger functor :
>
> file foo.ml
>
> module Make(ZZp:ZZpSig) =
> struct ... end
>
> file bar.ml
>
> module Make(ZZp:ZZpSig) =
> struct ... end
>
> file library.ml
>
> module Make(ZZp:ZZpSig)=
> struct
> module Foo = Foo.Make(ZZp)
> module Bar = Bar.Make(ZZp)
> end
> --
> Rémi Vanicat
> vanicat@labri.u-bordeaux.fr
> http://dept-info.labri.u-bordeaux.fr/~vanicat
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>
--
|--------/ Yaron M. Minsky \--------|
|--------\ http://www.cs.cornell.edu/home/yminsky/ /--------|
Open PGP --- KeyID B1FFD916 (new key as of Dec 4th)
Fingerprint: 5BF6 83E1 0CE3 1043 95D8 F8D5 9F12 B3A9 B1FF D916
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2002-03-18 12:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-18 4:09 Yaron M. Minsky
2002-03-18 9:01 ` Remi VANICAT
2002-03-18 12:19 ` Yaron M. Minsky [this message]
2002-03-18 12:52 ` Sami Mäkelä
2002-03-19 23:27 ` Yaron M. Minsky
2002-03-19 23:44 ` Fermin Reig
2002-03-20 9:09 ` Francois Pottier
2002-03-20 11:24 ` Alain Frisch
2002-03-20 12:59 ` Yaron M. Minsky
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=1016453982.27588.53.camel@dragonfly.localdomain \
--to=yminsky@cs.cornell.edu \
--cc=caml-list@inria.fr \
--cc=vanicat@labri.u-bordeaux.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