Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-28 Thread Steve Simmons
On Thu, Aug 24, 2000 at 03:40:00PM -, Perl6 RFC Librarian wrote: This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Case ignoring eq and cmp operators IMHO this problem is better solved by using =~ and its brethren, which already allow you to do

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-25 Thread David L. Nicol
Perl6 RFC Librarian wrote: =head1 IMPLEMENTATION Probably has to be added to perl internals... I wonder what will happen with overloads though - is eq/i a new operator to overload or is the case-insensitivity somehow magically done by the Perl interpreter even though eq was overloaded?

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-25 Thread David L. Nicol
Last week when I wrote "everything is an exception" this is what I was talking about. Nathan Torkington wrote: This raises another issue, though: You'd obviously want to have a module that collected together your favourite new operators. But if they were lexically scoped, they'd be

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-25 Thread Nathan Torkington
David L. Nicol writes: If we use exceptions of some kind to handle syntax, encountering an exception of type "unknown-keyword:Cmp" could result in the subroutine definition getting run to clarify this piece of code. I'm nervous about this. I'm trying to picture what happens, and having

RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Case ignoring eq and cmp operators =head1 VERSION Maintainer: Markus Peter [EMAIL PROTECTED] Date: 24 Aug 2000 Version: 1 Mailing List: [EMAIL PROTECTED] Number: 143 =head1 ABSTRACT Perl

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Jarkko Hietaniemi
On Thu, Aug 24, 2000 at 03:40:00PM -, Perl6 RFC Librarian wrote: This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Case ignoring eq and cmp operators =head1 VERSION Maintainer: Markus Peter [EMAIL PROTECTED] Date: 24 Aug 2000

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Dan Sugalski
At 10:56 AM 8/24/00 -0600, Tom Christiansen wrote: Also, they further complicate statements and they are counter-intuitive for beginners - why should I change the case of variables if I only want to compare them? Again, I reach the contrary conclusion: they say exactly what they are doing,

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Markus Peter
--On 24.08.2000 10:56 Uhr -0600 Tom Christiansen wrote: The probably worst about these statements is that they look ugly. To the contrary: in the case (ahem) of the application of lc() on the comparison's operand, they look especially beautiful. Depends on taste I guess... Also, they

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Tom Christiansen
While I don't know that I'd argue in favor of this feature request, your argument against misses the mark here. It's saying, essentially, that the difference between "P" and "p" is the same as the difference between -1 and 1. That, as they say, turns out not to be the case. The upper and

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Nathan Torkington
We need a way to mix eq, the things to be compared, and the operation to be done on them before they are compared: lc{ $foo eq $bar } $foo eq (lc) $bar $foo eq{lc} $bar None of those are like any existing syntax in Perl. The current way: lc($foo) eq lc($bar) seems fine in

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Dan Sugalski
At 11:33 AM 8/24/00 -0600, Tom Christiansen wrote: While I don't know that I'd argue in favor of this feature request, your argument against misses the mark here. It's saying, essentially, that the difference between "P" and "p" is the same as the difference between -1 and 1. That, as they

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Jarkko Hietaniemi
On Thu, Aug 24, 2000 at 10:28:51PM +0200, Bart Lateur wrote: On 24 Aug 2000 15:40:00 -, Perl6 RFC Librarian wrote: Perl currently only has Ceq and Ccmp operators which work case-sensitively. It would be a useful addition to add case-insensitive equivalents. Next you'll want

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread John Porter
Bart Lateur wrote: Suppose you want to keep the case on the hash keys, because you enumerate them. But you still want to find hash entries in a case insensitive manner... ...then you simply reach for Tie::CPHash on CPAN! -- John Porter

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Bryan C . Warnock
On Thu, 24 Aug 2000, Nathan Torkington wrote: You'd obviously want to have a module that collected together your favourite new operators. But if they were lexically scoped, they'd be lexically scoped to the module they were defined in, i.e. your collection rather than your main program.

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Nathan Torkington
Dan Sugalski writes: Personally I think I'm in favor of Nat's suggestion of allowing the definition of new infix operators and let this be taken care of in a module, but that's just passing the buck. (Not that it's a bad strategy, mind... :) Solve the generic problem, not a specific one.

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Jarkko Hietaniemi
I want four special new comparison operators. Firstly, " e q " That is, an operator that ignores any leading, any trailing, and treats all intraspace as equivalent. If the embedded space is confusing, I may consider suggesting an operator modifier, "/ ". Secondly, Eq, which

Re: RFC 143 (v1) Case ignoring eq and cmp operators

2000-08-24 Thread Tom Christiansen
Case ignoring eq and cmp operators =head2 Problems with current ways to do it Perl currently knows basically two methods for checking of equality of strings case-insensitively: uc($a) eq uc($b) $a =~ /^$b$/i and for comparing them one: uc($a) cmp uc($b) The probably worst about these