From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA15050 for caml-red; Wed, 6 Sep 2000 21:42:44 +0200 (MET DST) 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 JAA08958 for ; Wed, 6 Sep 2000 09:03:18 +0200 (MET DST) Received: from mail.mimuw.edu.pl (pm47.warszawa.cvx.ppp.tpnet.pl [213.76.108.47]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e8673AX16779 for ; Wed, 6 Sep 2000 09:03:11 +0200 (MET DST) Received: (from news@localhost) by mail.mimuw.edu.pl (PLD/8.9.3) id IAA27245 for caml-list@inria.fr; Wed, 6 Sep 2000 08:33:49 +0200 X-Authentication-Warning: qrnik.knm.org.pl: news set sender to qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) using -f From: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) Subject: Re: Language Design Date: 6 Sep 2000 06:33:45 GMT Organization: Klub Nieszkodliwych =?iso-8859-2?Q?Manjak=F3w?= Message-ID: References: <3145774E67D8D111BE6E00C0DF418B662D78C0@nt.kal.com> <39B5DD81.E2500203@maxtal.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: qrnik.knm.org.pl 968222025 27243 127.0.0.1 (6 Sep 2000 06:33:45 GMT) X-Complaints-To: news@qrnik.knm.org.pl NNTP-Posting-Date: 6 Sep 2000 06:33:45 GMT User-Agent: slrn/0.9.6.2 (Linux) To: caml-list@inria.fr Sender: weis@pauillac.inria.fr Wed, 06 Sep 2000 17:00:33 +1100, John Max Skaller pisze: > A smarter implementation would be lazy, and buffer all data which > was actually read, until it could no longer be accessed. Assuming that primitive tape reading lives in the IO monad, implementation of this reading would have to rely on unofficial constructs that allow escaping from IO, or at least delaying an IO action until a value is evaluated. The function would no longer be pure, even though its type says so. Examining its result causes a side effect of reading the tape further. This light effect may nevertheless matter. This is the case of Haskell's reading of whole files, which is lazy and unimplementable using official single-character IO primitives. It has its problems, recently discussed: what if I later write to that file back? The meaning may depend on how much of the input was evaluated. Implementations should probably detect this case and read the remaining input immediately... Providing input from I/O as a lazy list is very convenient but unfortunately tricky. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTĘPCZA QRCZAK