I thought I might start to classify bugs---create a taxonomy, so to speak, that perhaps gives a latin name to every species.
I could start with the one I beat my head against today. I wanted to print some formatted text.
use Text::AutoFormat;
$text = autoformat( $entry, { ... } );
print $entry;
It deserves a name---a really important name---to elevate it beyond its mere stupidity into some sort of software engineering jabberwocky worthy of conference presentations, journal articles, and high brow discussion.
Side effects considered harmful?
Re:jabberwordy
petdance on 2004-01-12T14:41:20
Not a side effect. The variable doesn't get modified....Re:jabberwordy
inkdroid on 2004-01-12T14:58:45
use Text::AutoFormat;
$text = autoformat( $entry, {... } );
print $entry;It looks to me that there was some (perhaps unconscious) expectation that $entry was going to be modified by the call to autoformat(). Perhaps "Unconscious/Anticipatory Side-Effect Considered Harmful" would be better? If not it might be a useful topic for some postmodern criticism
:-) <aside>Ain't it nice to be able to comment in brian's journal?.../me wonders how long this can last.</aside>
Re:jabberwordy
petdance on 2004-01-12T15:13:45
I just figured it was a brainfart when adding the autoformat call, that the code was originally something like:and brian said "Hey, I want formatting", and added the autoformat line.$entry = get_the_entry();
print $entry;At least, that's usually how I get in this situation...$entry = get_the_entry();
$text = autoformat( $entry, {...} );
print $entry;Re:jabberwordy
inkdroid on 2004-01-12T15:37:56
"Brainfart" now that's "worthy of high discussion"
:-) Perhaps "Brainus Farticus" would lend it more latin flavor (or not). Seriously though, brian's error looked to me like it was coming from too much C programming, a la... stpcpy (char *to, const char *from)"C Considered Harmful"? Nah...
Re:jabberwordy
brian_d_foy on 2004-01-13T04:32:36
I can see Ed's point, and if I had showed the progression of my thought, it would have been more clear (or maybe less). I wanted to use $text, but something earlier was messing up, so I put $entry into the string, although it was ugly, unformatted HTML. I never changed it back to $text.
[I'll keep comments on from now on. At the beginning I was just afraid of a bunch of people saying really stupid things (like on other blog/journal sites, but use.perl does not really have a lot of that]
I think that for short programs, both bugs might be caught by use warnings; but in long programs, your bug is more likely to be undetected becase both names will be reused.use warnings;
$value = 42;
print "$valu is the answer.\n";
I would call your bug something like "unintended discarded outputs." Which doesn't sound very high-falutin', but oh well.