develooper Front page | perl.perl5.porters | Postings from November 2011

Re: RFC: fc keyword API

Thread Previous | Thread Next
From:
Johan Vromans
Date:
November 26, 2011 08:52
Subject:
Re: RFC: fc keyword API
Message ID:
m2aa7isu5f.fsf@phoenix.squirrel.nl
Ricardo Signes <perl.p5p@rjbs.manxome.org> writes:

> * Johan Vromans <jvromans@squirrel.nl> [2011-11-26T10:24:44]
>> As I see it, the solution:
>> 
>> >     fc($a) eq fc($b)
>> 
>> is the ASCII approach to case-insensitive comparison.
>
> What's ASCII about Σίσυφος turning into σίσυφοσ?

I called it 'the ASCII approach', since 

  lc($a) eq lc($b)

was the approach for case-insensitive comparison of ASCII strings,
initially.

The underlying question, however, is how to compare strings
in a case-insensitive manner, which is much better described by

  $a ieq $b

since this does not include a specific approach to obtaining the answer.

If Perl had chosen "ieq" for case-insensitive comparison, then ASCII or
Latin or Unicode would not have mattered [to the programmer].

In other words: "$a ieq $b" describes a generic problem, "lc($a) eq
lc($b)" is a specific solution.

-- Johan



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About