[Haskell-cafe] Very crazy
Andrew Coppin
andrewcoppin at btinternet.com
Tue Sep 25 06:59:02 EDT 2007
Chaddaï Fouché wrote:
> 2007/9/25, Andrew Coppin <andrewcoppin at btinternet.com>:
>
>> Forget PrintfType - I can't even understand the haddoc page yet!
>>
>> (printf performs I/O, yet it is outside the I/O monad. It seems to
>> accept an arbitrary number of arguments, which is obviously impossible.
>> It's *almost* as scary as the original. Although the original will crash
>> your program is you use it wr... oh, so does this one. Cool.)
>>
>
> printf don't always perform IO : if you ask it for a String it will
> happily turn into sprintf for you, if you use it in the IO Monad, it
> will indeed perform IO, but there's nothing fundamentally IO bound in
> printf logic.
>
That's even *more* impossible... o_O
> Well printf crash your program because it can't check if you're
> arguments correspond to the chain at compile time (quite obviously
> since the chain itself can be dynamic), but it won't corrupt memory or
> anything from this kind, so it's arguably much better than the C one.
>
All I know is that in C, any attempt to use printf() has an 80%
probability of causing the machine to dump the entire contents of RAM to
stdout until it happens upon a zero byte. Probably the most annoying
part was all the 0x07 bytes in there. Do you know what a room full of
beeping PCs is like? I do... Sometimes when we got bored, we would
"race" our PCs to see which one would stop beeping first. (But they
stopped that when I worked out how to make mine "win" every race...)
More information about the Haskell-Cafe
mailing list