develooper Front page | perl.perl5.porters | Postings from May 2010

Re: [perl #75350] PATCH: revamp ibcmp_utf8() for efficiency, clarity

Thread Previous | Thread Next
May 28, 2010 14:18
Re: [perl #75350] PATCH: revamp ibcmp_utf8() for efficiency, clarity
Message ID:
On 25 May 2010 20:24, karl williamson <> wrote:
> # New Ticket Created by  karl williamson
> # Please include the string:  [perl #75350]
> # in the subject line of all future correspondence about this issue.
> # <URL: >
> The first times I looked at this routine, it seemed incomprehensible.  I
> had to come back to it to fix a bug after working on other parts of Perl
> for a while, and it wasn't as foreign as before.  But I had to really
> understand it, so I started adding comments, and discovered that it was
> checking a number of things each time in the loop that could have  been
> figured out once.  So I ended up revamping it, keeping the same algorithm.

Somebody please figure out how to clone Karl so we have a backup. Thanks.

On a more serious note...

This looks much nicer to read than the original. ++ to you.

+Returns true if the strings s1 and s2 differ case-insensitively, false
+if they are equal case-insensitively.  Note that this is the complement of what
+you might expect (perhaps it would have been better to name it C<ibncmp_utf8>).

Seems to me that cmp routines always behave like this, they return -1
for inorder but different, 0 for different, and 1 for reverse order.

Anyway, the only other thing that occurs to me is that if it is going
to be rewritten, and reindented, could we lose the tabs please?

Besides these nits I vote apply.


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About