On Fri, Nov 26, 2010 at 02:20:40AM -0800, Reverend Chip wrote: > On 11/26/2010 1:23 AM, Nicholas Clark wrote: > > Isn't the bug that perl let someone create an invalid data structure? > > That's an internally consistent position (no pun intended). But does > the utf8 flag truly count as internal if manipulating it is both easy > and well-documented for users? easy (yes, too easy), documented (maybe, not well enough, particularly about what it's about) and WRONG. (WRONG in the general case. It feels like an awful lot of end-user code to deal with encodings is heuristics and bodgery, rather than actual understanding) > In any case, it's a fair cop that Encode::Guess has a bug in that it led > the application down the road to ruin. > > As a separate matter, perhaps we can at least agree that assert() is an > unfriendly thing for Perl to do in this case; I needed to run my program > with -Dt just to discover which line of Perl code triggered the > failure. Perhaps croak() would be a better way to react to invalid > strings, even if the bug [as I would describe it] can't be fixed. Where do you stop? If all the internal state is allowed to be wrong at any point, should there be validation checks everywhere? Nicholas ClarkThread Previous | Thread Next