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

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 t

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 >

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 overl

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 on

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 Mark Cogan
At 02:09 PM 8/24/00 -0400, John Porter wrote: >Markus Peter wrote: > > > > Another possibility would be to use cmpi and eqi > >Actually, all we need is cmpi, since eqi is just !cmpi. >(And eq is !cmp.) Nope. Read the manual. --- Ma

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 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 C and C operators which work case-sensitively. > >It would be a useful addition to add case-insensitive equivalents. > > Next you'll want case)ins

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

2000-08-24 Thread Bart Lateur
On 24 Aug 2000 15:40:00 -, Perl6 RFC Librarian wrote: >Perl currently only has C and C operators which work case-sensitively. >It would be a useful addition to add case-insensitive equivalents. Next you'll want case)insensitive hashes! Er... actually, that sounds rather useful, even more tha

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

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

2000-08-24 Thread Glenn Linderman
Yes, these all sound useful! Damian, could you make sure they get included in your switch statement? And don't forget =:= which should compare lazy, infinite sublists, as in if ( 4..:2 =:= 2 * ( 2.. )) { ... } Jarkko Hietaniemi wrote: > I want four special new comparison operator

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

2000-08-24 Thread John Porter
Markus Peter wrote: > > Another possibility would be to use cmpi and eqi Actually, all we need is cmpi, since eqi is just !cmpi. (And eq is !cmp.) -- John Porter if ( abs($a cmp $b) cmp abs($b cmp $a) ) ...

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 compari

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

2000-08-24 Thread Tom Christiansen
>In my consideration, a >case-insensitive equality check is a rather common operation in Perl >programs so it deserves its own operator. That doesn't folllow. We already have a trivial and very obvious way of doing it that doesn't require that any one learn anything new that they don't already

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 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,

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 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 >ar

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 t

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

2000-08-24 Thread Kevin Walker
>Perl currently only has C and C operators which work >case-sensitively. >It would be a useful addition to add case-insensitive equivalents. I think this is an excellent idea. I personally would find it very useful. > $a eq/i $b > $a cmp/i $b > >This still leaves some room for future additi

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 200

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 curre