<?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="2002/07/dc781b0623ef875df91c3aafad01e44c"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-05T10:15:23"
  subject="Re: [Caml-list] Re: generic programming"
  prev="2002/07/2bd282060b80b73e41fc932d3d2060e1"
  next="2002/07/e2cc2ea7d256e2884b0218dbe99e4f49"
  prev-in-thread="2002/07/fa6f4b49227ef840303e76915d7f82e0"
  next-in-thread="2002/07/d32dd70947be26ad7baf537ea0fb45f5"
  prev-thread="2002/07/562bfd7c9196fc3abcb454d8d4965868"
  next-thread="2002/07/b063648a2dd6d86053cf686570b2117e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] generic programming">
<msg 
  url="2002/07/729263137a5c609a8795ff7b62ccf4d0"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-03T02:46:19"
  subject="[Caml-list] generic programming">
<msg 
  url="2002/07/086229a0f9b30e86a6556869bfe538ce"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-03T08:43:01"
  subject="Re: [Caml-list] generic programming">
<msg 
  url="2002/07/e2cc2ea7d256e2884b0218dbe99e4f49"
  from="Anton Moscal &lt;msk@m...&gt;"
  author="Anton Moscal"
  date="2002-07-05T13:28:26"
  subject="Re: [Caml-list] generic programming">
</msg>
</msg>
<msg 
  url="2002/07/dcbb97e00ea9ea5a3640e48d394074e9"
  from="Ketanu &lt;ketanu@w...&gt;"
  author="Ketanu"
  date="2002-07-03T08:43:22"
  subject="[Caml-list] Re: generic programming">
<msg 
  url="2002/07/81f12c5cad32eba3f02fcc732a0b0eb6"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-03T17:43:58"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/0314e671c829ee05f5aa5680605ecbd1"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-03T20:04:53"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/46e8a07b4366726933f941e9b77e5607"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-03T20:28:21"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/b0cf4d7882617fd27e03771a31589b70"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-04T15:33:31"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/b4d857a65ae262207463c99e98abb5f7"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-07T20:35:55"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/2702b480e76a128d5e149a4d57a81363"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-08T01:00:11"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/29380c5033d9738e56987cfd04cf7446"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-08T07:23:04"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/10/9771c361af322c3ddf2c05c7693bd197"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-10-15T10:29:08"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/bc290463a2fb18079bf6f399c5a50e6f"
  from="Peter Wood &lt;peter.wood@w...&gt;"
  author="Peter Wood"
  date="2002-07-03T21:53:52"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/54c375615f0a29b27858964a3ea565a1"
  from="james woodyatt &lt;jhw@w...&gt;"
  author="james woodyatt"
  date="2002-07-04T02:02:06"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
<msg 
  url="2002/07/f9169f3ec2d8758bc125264b2df6077c"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-04T15:18:38"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/9ef27ddc21bed28306035ffd3faf0846"
  from="Francois Pottier &lt;francois.pottier@i...&gt;"
  author="Francois Pottier"
  date="2002-07-05T08:42:51"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/fa6f4b49227ef840303e76915d7f82e0"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-05T09:25:54"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/dc781b0623ef875df91c3aafad01e44c"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-05T10:15:23"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/d32dd70947be26ad7baf537ea0fb45f5"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-05T13:54:38"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/aad5a743288a064f4f5588efca0b71f5"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-05T18:18:33"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/6678e85245a3edc1fb95174cb4e3330c"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-05T20:31:27"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
<msg 
  url="2002/07/7d4406847b9935e88eb5bb1f37218e5b"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-05T19:34:05"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
<msg 
  url="2002/07/3259c1827be396d71d70b2c7e2861447"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-05T19:31:26"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/00fb705ed9a16fca4d7ec6fcdd19a976"
  from="Francois Pottier &lt;francois.pottier@i...&gt;"
  author="Francois Pottier"
  date="2002-07-05T08:33:25"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/e5a3d181643111354651fc4afd3d96ab"
  from="Dave Berry &lt;daveb@t...&gt;"
  author="Dave Berry"
  date="2002-07-05T23:02:14"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/08/d395639496023bb4daa54d843df08749"
  from="Diego Olivier Fernandez Pons &lt;Diego-Olivier.FERNANDEZ-PONS@c...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2002-08-02T14:52:44"
  subject="[Caml-list] Streams">
<msg 
  url="2002/08/929519264a1aa2fef08921548f609164"
  from="Alain Frisch &lt;frisch@c...&gt;"
  author="Alain Frisch"
  date="2002-08-02T15:29:07"
  subject="Re: [Caml-list] Streams">
<msg 
  url="2002/08/3ba1a139a7e1050e9b2233e0cc9eb5c2"
  from="Diego Olivier Fernandez Pons &lt;Diego-Olivier.FERNANDEZ-PONS@c...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2002-08-03T14:22:03"
  subject="Re: [Caml-list] Streams">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/27f2e9a6fef12ae5f3dfeb79ca878644"
  from="Francois Pottier &lt;francois.pottier@i...&gt;"
  author="Francois Pottier"
  date="2002-07-08T09:54:55"
  subject="Re: [Caml-list] Re: generic programming">
<msg 
  url="2002/07/f49c4126b9e8f96224a3185f0b93557f"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-08T15:49:08"
  subject="Re: [Caml-list] Re: generic programming">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/0f2535d349e6014a883b1f763837db62"
  from="Jun P.FURUSE &lt;Jun.Furuse@i...&gt;"
  author="Jun P.FURUSE"
  date="2002-07-03T09:10:27"
  subject="Re: [Caml-list] generic programming">
</msg>
</msg>
</thread>

<contents>

&gt;Like François, I find functional iterators so much cleaner
&gt;and better structured.  Moreover, the extra "power" of imperative iterators
&gt;isn't obvious to me.

I think this is a very important point, but I totally disagree with your 
conclusion.  Giving up explicit control over the flow of your program is a 
serious problem in my opinion, and callback solutions force you to do 
that.  Iterating over two things at once is an obvious example of where it 
breaks down, but it happens in a lot of places.  Real closures make it less 
painful to deal with this than in languages without closures, because you 
can have the map/iter code right there acting locally, but closures still 
don't really eliminate the problem that you aren't in control of when that 
code gets called anymore.

As another example, this idiom/pattern actually shows up a lot in GUI APIs 
for things like events.  I think it's pretty clear at this point that 
callback based event handling code leads to more lines of less readable and 
harder to understand code than having the client code be able to pull 
things off a queue when it's ready for the events.  I'm sure some disagree 
with this statement.

Both of these are examples of "push versus pull" interfaces, and pull just 
seems to work better.  Having data pushed at you means you often end up 
buffering it on your end to manage your flow control anyway unless you're 
just doing some trivial processing.

Furthermore, it seems like it's a common trap to fall into saying the 
familiar "you don't want to do that" (like your comment about hashtables) 
when there's a fair amount of evidence that it's reasonable thing to want 
to do (and I think better in a lot of ways).  It seems like it's something 
a good language should support well.

I'm not saying that callback/push interfaces are always bad, just that 
there are strengths and weaknesses to both.  To reference the XML thread, 
there's a reason there are both DOM and SAX interfaces.  I wish Ocaml 
supported imperative/pull coding styles better, which is why I'm interested 
in this thread.

It's late...hopefully this mail made some sense.

Chris


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

