[Haskell-cafe] Top Level <-

Ganesh Sittampalam ganesh at earth.li
Sun Aug 31 13:20:12 EDT 2008


On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:

> On 2008 Aug 31, at 12:01, Ganesh Sittampalam wrote:
>> On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:
>>> On 2008 Aug 31, at 11:20, Ganesh Sittampalam wrote:
>>>> Where do the filehandle structures live in the latter case?
>>> 
>>> The place you clearly think so little of that you need to ask: 
>>> process-global (or process-local depending on how you think about it) 
>>> storage.  And everything in that storage must have locking.
>
>
> You'll have to look at specific implementations.  One that I can think of off 
> the top of my head is Perl 5's "ithreads"; there is a distinguished 
> allocation store which is global to all ithreads, and the interpreter 
> instance gives you primitives for locking and mutexing (see "use 
> threads::shared;").

>From what I can see from the source of this, it seems to rely on a global 
variable inside the Perl library that contains a pointer to the shared 
state area (actually a separate Perl interpreter of its own, but that's 
just an implementation detail). However I may be wrong as I was unable to 
fully figure out how the BOOT: mechanism works from a simple grep.

I'm afraid I don't see how this generalises to sharing something across an 
entire process where the things that want to do the sharing are not in or 
controlled by the same shared library. In particular the filehandle 
structures required for buffered I/O need to be common to every single 
piece of code in the process that might want to use them, no matter what 
language or language implementation that code uses.

Ganesh


More information about the Haskell-Cafe mailing list