[Haskell-cafe] Maybe a, The Rationale

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun May 11 09:52:40 EDT 2008

On 2008 May 11, at 5:09, PR Stanley wrote:

>>>>>        Um, I was encountering and recognizing times when I  
>>>>> really needed an
>>>>> out-of-band "null", and the pain of representing such in C,  
>>>>> shortly
>>>>> after I started serious programming in C (call it 1984-5).  Is  
>>>>> this
>>>>> really difficult?
>>>>      Paul: Hmm, I'm not quite sure what you're driving at.
>>> Me neither.
>> Null pointers, EOF markers, didn't find specified key in some tree,  
>> etc.
>        Paul: So much time is wasted on making the thing work even if  
> you have perfectly sound semantics. Still, that's a hundred times  
> more preferable to c++ and its anomalies and contradictions.  What  
> was Stroustroup thinking of! :-

My real point was that in the C programming culture it was/is far too  
common to use an in-band value; that is, one that could be confused  
with or treated as a valid response:  null pointers, stdio's EOF (=  
-1).  This just causes problems because code is almost encouraged to  
ignore the special cases.  For example, the ctype macros have to  
support being passed EOF.  Maybe types force you to deal with it,  
while simultaneously providing convenience functions to help you deal  
with it.

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