<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/e93bd0cf7e76cd82bbe9874192ba5515"
  from="Fernando Alegre &lt;fernando@c...&gt;"
  author="Fernando Alegre"
  date="2003-11-07T14:08:59"
  subject="Re: Why are functors better? (Re: [Caml-list] Map efficiency?)"
  prev="2003/11/810f9d2fb53a5d64dcf1e65d5252ea26"
  next="2003/11/0c6fb332cf336b39bf4442bf304e2f7b"
  prev-in-thread="2003/11/7ec5b0a474c6574105aed93a0b8e4678"
  next-in-thread="2003/11/0c6fb332cf336b39bf4442bf304e2f7b"
  prev-thread="2003/11/1d87c05e41bbe7ce253007f8039e67d7"
  next-thread="2003/11/26590f366f401c39cd62b82a784477dd"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Map efficiency?">
<msg 
  url="2003/11/5bfc54158708ba55850a695ef7c3c554"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-04T07:59:31"
  subject="[Caml-list] Map efficiency?">
<msg 
  url="2003/11/91764b53dcd86cc5f53036ba2f425604"
  from="Jean-Christophe Filliatre &lt;Jean-Christophe.Filliatre@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2003-11-04T09:26:33"
  subject="Re: [Caml-list] Map efficiency?">
<msg 
  url="2003/11/105804fae41a4cd8c283a86811016fc2"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-04T10:00:31"
  subject="Re: [Caml-list] Map efficiency?">
</msg>
<msg 
  url="2003/11/95f6667080814ef5f524be3244d1dd48"
  from="Issac Trotts &lt;ijtrotts@u...&gt;"
  author="Issac Trotts"
  date="2003-11-04T19:49:13"
  subject="Re: [Caml-list] Map efficiency?">
</msg>
</msg>
<msg 
  url="2003/11/5ef9da757ad2ccf960d678f264ec9887"
  from="Christian Lindig &lt;lindig@c...&gt;"
  author="Christian Lindig"
  date="2003-11-04T09:41:17"
  subject="Re: [Caml-list] Map efficiency?">
<msg 
  url="2003/11/dec982bc53112706fdf5984d7d508524"
  from="Alex Baretta &lt;alex@b...&gt;"
  author="Alex Baretta"
  date="2003-11-04T18:14:46"
  subject="Re: [Caml-list] Map efficiency?">
<msg 
  url="2003/11/fcf4916c9d449dfdc24dc7760ef38db4"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-11-05T01:09:46"
  subject="Re: [Caml-list] Map efficiency?">
</msg>
<msg 
  url="2003/11/20edba130889464de589400be1d0760d"
  from="Jean-Christophe Filliatre &lt;Jean-Christophe.Filliatre@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2003-11-07T08:41:32"
  subject="Re: [Caml-list] Map efficiency?">
<msg 
  url="2003/11/e1bad687e478861296fd916bf372c385"
  from="Yaron M. Minsky &lt;yminsky@c...&gt;"
  author="Yaron M. Minsky"
  date="2003-11-07T11:39:44"
  subject="Why are functors better? (Re: [Caml-list] Map efficiency?)">
<msg 
  url="2003/11/7ec5b0a474c6574105aed93a0b8e4678"
  from="Michael Hicks &lt;mwh@c...&gt;"
  author="Michael Hicks"
  date="2003-11-07T14:02:11"
  subject="Re: Why are functors better? (Re: [Caml-list] Map efficiency?)">
</msg>
<msg 
  url="2003/11/e93bd0cf7e76cd82bbe9874192ba5515"
  from="Fernando Alegre &lt;fernando@c...&gt;"
  author="Fernando Alegre"
  date="2003-11-07T14:08:59"
  subject="Re: Why are functors better? (Re: [Caml-list] Map efficiency?)">
</msg>
</msg>
<msg 
  url="2003/11/0c6fb332cf336b39bf4442bf304e2f7b"
  from="Florian Hars &lt;hars@b...&gt;"
  author="Florian Hars"
  date="2003-11-07T14:49:51"
  subject="Re: [Caml-list] Map efficiency?">
</msg>
</msg>
</msg>
<msg 
  url="2003/11/26e98349ede248f8c61411089f48e045"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-04T19:38:12"
  subject="Re: [Caml-list] Map efficiency?">
</msg>
</msg>
</msg>
</thread>

<contents>
On Fri, Nov 07, 2003 at 06:39:41AM -0500, Yaron M. Minsky wrote:

&gt; Functors would be a lot more useful if they could be used as a
&gt; large-scale structural tool.  Sadly, the current implementation makes
&gt; this quite difficult, since there's no good way of parameterizing
&gt; multiple modules at once (as noted in a previous thread.  See


This seems to be related to the fact that modules are not first class objects. If they
were, you could easily parametrize across modules:

In file x.ml:

module type SIGX = sig ... end
type x_module = SIGX

module X = struct ... end

let x = module (X:SIGX) (* type of x is x_module *)

In file a.ml:

module A = struct

  let f x = let module X = x in X.do_something()

In file b.ml:

module B = struct

  let f x = let module X = x in X.do_something() + A.do_something()

end

This code, of course, cannot be compiled. However, the corresponding version with
classes is trivial to do. This fact seems to be one of the strong reasons why people
prefer them over modules, despite the tendency of classes to become long spaghetti.

Fernando

-------------------
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

</contents>

</message>

