[Haskell-cafe] Mutable arrays
Andrew Butterfield
Andrew.Butterfield at cs.tcd.ie
Fri Feb 15 06:05:11 EST 2008
Stefan O'Rear wrote:
> On Wed, Feb 06, 2008 at 08:57:43PM +0000, Andrew Butterfield wrote:
>
>> In Clean, we not only have explicit access to the world, but
>> we can partition it. Simplifying somewhat, we could open up
>> pairs of file-handle (f1.in,f1.out), (f2.in,f2,out) ... (fn.in,fn.out),
>> which does have to be done sequentially, since each file opening modifies
>> the (global) filesystem. However, once this is done,
>> we could, in principle, execute the fn in any order,
>> and indeed in such a way that the implementation could choose to
>> do them in parallel - this potential for (admittedly limited)
>> deterministic parallel execution of I/O actions is possible with
>> uniqueness types, but not epxressible in the monadic world as
>> currently formulated.
>>
>
> What if f1.out is a symlink to f2.out? I don't think Clean satisfies
> the evaluation order independance that is so treasured here.
>
Sorry for lateness in getting back - it's been one of those fortnights..
The case you mention won't arise simply because during the process
of opening these file-handles (which cannot be done in parallel, because
they all
modify the filesystem), the write conflict will be detected, and the
opening of the
second one will fail.
Once the file-handle pairs are all opened we have a guarantee that all
writes are to distinct files.
--
--------------------------------------------------------------------
Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
Foundations and Methods Research Group Director.
Course Director, B.A. (Mod.) in CS and ICT degrees, Year 4.
Department of Computer Science, Room F.13, O'Reilly Institute,
Trinity College, University of Dublin, Ireland.
http://www.cs.tcd.ie/Andrew.Butterfield/
--------------------------------------------------------------------
More information about the Haskell-Cafe
mailing list