haskell-cafe@haskell.org
[Top] [All Lists]

Re: [Haskell-cafe] Maybe a, The Rationale

Subject: Re: [Haskell-cafe] Maybe a, The Rationale
From: "Brandon S. Allbery KF8NH"
Date: Sun, 11 May 2008 09:52:40 -0400

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@xxxxxxxxx
system administrator [openafs,heimdal,too many hats] allbery@xxxxxxxxxxx
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>