openTempFile only defined on GHC

Simon Marlow simonmarhaskell at gmail.com
Mon Apr 2 08:58:22 EDT 2007


Malcolm Wallace wrote:
> Simon Marlow <simonmarhaskell at gmail.com> wrote:
> 
>> Isn't it just a bug that these functions are not implemented by other
>> compilers? 
> 
> Yes and no.  Of course we could implement them.  But I for one wasn't
> even aware that they existed in the API.  I don't know when they were
> added, or by whom, and I may not even be sure what they are supposed to
> do.  For instance, you mention not opening a file if it already exists,
> but the Haddock does not say anything about that.

They were added in Jan 2005 by Krasimir:

Thu Jan  6 19:35:07 GMT 2005  krasimir
   * [project @ 2005-01-06 19:35:05 by krasimir]
   add temporary files API

I agree the documentation is lacking and should be improved.  The reason they 
were added to System.IO, I suspect is because the alternative is worse: 
System.IO.Extras, GHC.IO.Extras or something else.  Apart from being 
uninformative names, there's nothing compiler-dependent about these functions, 
and our naming guidelines forbid module names that don't have anything to do 
with functionality.  The intention was that the missing implementations would 
appear in due course.

Perhaps as a first step, rather than just omitting them from the export list 
where they aren't supported, they should be replaced by dummy definitions that 
emit a helpful error message?

I suspect there are many such examples in the base package, FWIW.  nch98 doesn't 
implement various bits of System.IO.Error, for example.  Hugs has a very 
different version of Control.Concurrent.

Cheers,
	Simon


More information about the Libraries mailing list