From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id EAA09900; Thu, 29 Apr 2004 04:35:18 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA09895 for ; Thu, 29 Apr 2004 04:35:16 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3T2ZDYM009083 for ; Thu, 29 Apr 2004 04:35:15 +0200 Received: from [192.168.1.200] (ppp114-169.lns1.syd3.internode.on.net [150.101.114.169]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i3T2Z8Zq020410; Thu, 29 Apr 2004 12:05:09 +0930 (CST) Subject: Re: [Caml-list] [ANN] The Missing Library From: skaller Reply-To: skaller@users.sourceforge.net To: Jon Harrop Cc: caml-list In-Reply-To: <200404290256.24399.jdh30@cam.ac.uk> References: <200404281942.05371.jdh30@cam.ac.uk> <1083200626.9537.1199.camel@pelican.wigram> <200404290256.24399.jdh30@cam.ac.uk> Content-Type: text/plain Message-Id: <1083206107.9537.1224.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 29 Apr 2004 12:35:08 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 2004:99 inverted:01 generic:01 inverted:01 recursion:01 callback:01 generalise:01 callback:01 char:01 threads:01 9660:01 glebe:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 2004-04-29 at 11:56, Jon Harrop wrote: > On Thursday 29 April 2004 2:03 am, skaller wrote: > > You are missing the point. > > I sure am. ;-) > > > Neither solution control inverts. > > Does that mean that my function is being called by map, rather than having my > function explicitly fetch the next element? Yes. > > So they're both weak. > > By this, do you mean that "control inverted" functions are more generic? The control inverted (thread-of-control) solution allows to use the stack in the traditional way. For example recursion. So it can solve at least context free problems. A callback with finite state object is clearly limited to finite state machine: can only solve regular problems. Of course you can build more complex state object in both cases to generalise. The point of the algorithmic solution is that at least some of that state can be expressed naturally with lexical scoping and control flow. I suggest you consider some C program which processes files .. and rewrite it now please to be a callback void accept_character(char x) { } and you will see what I mean. This is untenable. What does the OS do for you? It control inverts. Most OS swap stacks to do this. This is also one reason to use threads, unrelated to asynchronicity. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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