Am Montag, 24.11.03 um 08:38 Uhr schrieb Daniel Macks:


On Sun, Nov 23, 2003 at 07:54:36PM +0100, Max Horn wrote:
Am Freitag, 21.11.03 um 10:08 Uhr schrieb Daniel Macks:

Update of /cvsroot/fink/fink/perlmod/Fink In directory sc8-pr-cvs1:/tmp/cvs-serv14848

Modified Files:
        ChangeLog Services.pm
Log Message:
Revert handling $prefix1/$prefix2 in print_breaking to the way it was
before removal of print_breaking_* (which seems to be the correct
behavior).

May I ask what exactly this fixes? I.e. in which cases was the code causing problems?

The previous change broke handling of prefixes that were logically false. Consider what happens for

my $prefix1 = shift || "";

if one passed the zero chacter.

Uhm, so? That's intended behavior then. Passing the "zero character" as a prefix is abuse of the function.


 That makes the shift false, so the
null string is used instead. (No, I can't find a place where this is
actually done, but it's a commonly-(mis)used idiom.)
Ah so you didn't fix a problem, you just fixed a hypothetical issue :-). That's all I wanted to know. FWIW, I never have seen this "commonly-(mis)used idiom" anywhere... either you specify no prefix (so the default one is used), or you specify a legal (string) prefix. Passing a zero char is incorrect. So it seems to me we could have either left the code as it was, or add an explicit check which makes the code bail out if an illegal prefix was passed in :-)

By switching (back) to checking that it's defined at all (even if logically false) this gotcha is removed.

I guess my irritation simply stems from the fact that I don't consider this a gotcha - rather it's something you should never do... :-)


 I hear perl5.9 will have a new single operator
that does what (I assume, and therefore re-implmented) was meant. If
not, obviously feel free to undo the change.

I just got this feeling somebody might again change it back and forth for whatever obscure reasons :-). I don't mind much either way, I just thought the code was easiest to read the way I put it... YMMV.


Cheers,


Max



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to