[Haskell-cafe] Re: [Haskell] Top Level <-

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Aug 31 10:37:29 EDT 2008


On 2008 Aug 31, at 10:34, Ganesh Sittampalam wrote:
> On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:
>> On 2008 Aug 31, at 10:29, Ganesh Sittampalam wrote:
>>> On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:
>>>> On 2008 Aug 31, at 10:20, Ganesh Sittampalam wrote:
>>>>> I'm not sure of precisely what you mean here, but stdin, stdout  
>>>>> and stderr are things provided by the OS to a process. That's  
>>>>> what defines them as having process scope, not something the  
>>>>> Haskell language or RTS does.
>>>> But their representations in Haskell must have the same scope and  
>>>> are therefore de facto global variables.
>>> Yep, but this is not Haskell providing a way to make global  
>>> variables, it is just providing an interface to ones that already  
>>> exist. The point is that the RTS can't provide (process-scope)
>>
>> But that is done the same way as providing general global  
>> variables, so you can't get away from it.
>
> I don't follow what you mean. stdin, stdout and stderr are just file  
> descriptors 0, 1 and 2, aren't they? You can create them as many  
> times as you want with using that information without causing any  
> confusion or conflict. Whereas the <- proposal has a "once-only"  
> requirement.

The convention is to provide buffered versions to improve the  
performance of file I/O.  These buffered filehandles must be created  
once per runtime instance (and ideally once per process so multiple  
runtimes don't find themselves overwriting each others' output).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list