[Haskell-cafe] Re: Hugs vs GHC (again)was: Re: Somerandomnewbiequestions

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Wed Jan 12 18:52:04 EST 2005


Marcin 'Qrczak' Kowalczyk wrote:

 >File positions are not evil. They allow to treat files and devices
 >in a uniform way.

Indeed, file positions are exactly as evil as indices into shared memory 
arrays, which is to say not evil at all. But suppose each shared memory 
array came with a shared "current index", and there was no way to create 
additional ones. Suppose you couldn't index the array by a local 
variable: instead, you had to store the local variable into the shared 
index register first, overwriting whatever was there before. If you only 
wanted to use the array as a source or sink for a single stream, that 
would be fine. In every other case, it would be awful. Even read-only 
sharing would require the invention of some sort of cooperative locking 
discipline, and if some process didn't respect the locking and couldn't 
be changed, read-only sharing would become impossible. That's just silly.

The way to solve this problem is to decouple the index from the shared 
memory array. You can easily simulate the single-index behavior if 
that's what you want, but you also get a lot of additional functionality.

-- Ben



More information about the Haskell-Cafe mailing list