dimanche 30 novembre 2014

How to call an internal incorrect behaviour that does not manifest itself as a bug?


To put this in context, I have the following scenario. I am writing a Common Lisp program that works with strings and lists of characters.


In a certain function foo, the value of a variable suff is a list of characters. Further on in the code, I forgot that suff was a list and treated it as a string, calling



(subseq suff 0 1)


I did not notice the mistake, because subseq works both on strings and lists:



CL-USER> (subseq "abc" 0 1)
"a"

CL-USER> (subseq '(#\a #\b #\c) 0 1)
(#\a)


So in the subsequent code I assumed I was working with strings while in fact I was moving around lists of characters.


These wrongly-typed results were finally formatted by the program's output function using (concatenate 'string .... I was lucky, because concatenate happily produces a string when given lists of characters as arguments.


I only discovered this mistake when adding more tests (yes, I know, TDD, but that's another topic) and testing foo directly.


Since my program was running properly - at the time my output function was the only piece of code that was using the corrupted data - I cannot say that the program as a whole contained a bug even though function foo, taken separately, was buggy.


Is there a special name to describe such an incorrect internal behaviour that does not manifest externally as a bug?





Aucun commentaire:

Enregistrer un commentaire