bugs from n+k patterns (was: Re: Preventing/handling space leaks)

Iavor S. Diatchki diatchki at cse.ogi.edu
Thu Dec 11 06:23:51 EST 2003


hi,

first here is why i think n+k patterns are problematic;
1) they lead to some parsing awkwardness (e.g. when n+k pattern bindings 
are involved, but those don'treally make much sense anyways)
2) in haskell as it is, patterns are associated with algebraic 
datatypes, and n+k patterns may erronously suggest that all numbers are such

for the rest, apologies if i appear to be ranting :-)

Henk-Jan van Tuyl wrote:

> 1) It takes no effort, once you are use to it, to code without n+k 
> patterns; 

this does not seem like a good argument.  there are many other features 
like that in haskell. for example, going by that we could
remove lambda abstractions (i am not saying we should)

> on the other hand, when you often use these patterns, you might spend 
> hours debugging an endless looping program. 

how do n+k patterns lead to looping programs?

> If you are working under high pressure in a large project, chances 
> are, that the testing departement will find your bug and write a bug 
> report (or worse, the customer might find it). Report handling and bug 
> solving costs an enormous amount of money. This has resulted in the 
> "clean room" approach for software design: prevent bugs rather than 
> solve them. See also Finnagle's Law.

i find this reasoning backward.  i agree (of course!) that we should 
write programs without bugs. 
i find it strange that people often motivate that, by telling me that 
bugs cost a lot of money for some company.
if companies happened to make money out of bugs (and some do), would it 
then be ok to write buggy software?
i guess it all comes down to what one takes as primary -- writing good 
software, or making money.

> 2) It is likely, that n+k patterns dissapear in the next Haskell 
> standard. If you don't like to rewrite, test and debug all your 
> software every few years, don't use any language/compiler features 
> that are likely to dissapear. This is another thing that might cost 
> companies a lot of money.

i didn't know anyone is working on a next haskell standard.  have n+k 
patterns been made obsolete?

-iavor

-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               | 
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================




More information about the Haskell-Cafe mailing list