Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: Language Design
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: qrczak@k...
Subject: Re: Language Design
Wed, 06 Sep 2000 17:00:33 +1100, John Max Skaller <skaller@maxtal.com.au> 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