December 27, 2001
Walter wrote:

> "Russell Borogove" <kaleja@estarcion.com> wrote in message
> news:3C2A1913.9050303@estarcion.com...
>>Do you anticipate wanting to compare slices for reference
>>identity rather than for content identity?
>>
> 
> Yes.
> 
> 
>>It's a little
>>perlesque/DWIMy, but could you treat slice syntax differently
>>in comparison expressions than in assignment or other
>>expressions?
>>
> 
> Each special case adds complexity, that doesn't mean it is not worth doing,
> the case just has to be fairly compelling.
> 


Okay, well, then, let's get back to thinking of a good operator to
use for array content comparison.

   if (a $= b)     // "string equal" to speakers of BASIC
   if (a []= b)    // "array equal"
   if (a === b)    // because = and == aren't confusing enuf

-RB



December 27, 2001
"Russell Borogove" <kaleja@estarcion.com> wrote in message news:3C2B67E5.20207@estarcion.com...
> Walter wrote:
>
> > "Russell Borogove" <kaleja@estarcion.com> wrote in message news:3C2A1913.9050303@estarcion.com...
> >>Do you anticipate wanting to compare slices for reference identity rather than for content identity?
> >>
> >
> > Yes.
> >
> >
> >>It's a little
> >>perlesque/DWIMy, but could you treat slice syntax differently
> >>in comparison expressions than in assignment or other
> >>expressions?
> >>
> >
> > Each special case adds complexity, that doesn't mean it is not worth
doing,
> > the case just has to be fairly compelling.
> >
>
>
> Okay, well, then, let's get back to thinking of a good operator to use for array content comparison.
>
>     if (a $= b)     // "string equal" to speakers of BASIC
>     if (a []= b)    // "array equal"
>     if (a === b)    // because = and == aren't confusing enuf

The idea:

    a [==] b
    a [<] b
    a [>=] b

is sort of appealing <g>.


December 27, 2001
Walter wrote:

> "Russell Borogove" <kaleja@estarcion.com> wrote in message
> news:3C2B67E5.20207@estarcion.com...
>>Okay, well, then, let's get back to thinking of a good operator to
>>use for array content comparison.
>>
>>    if (a $= b)     // "string equal" to speakers of BASIC
>>    if (a []= b)    // "array equal"
>>    if (a === b)    // because = and == aren't confusing enuf
>>
> 
> The idea:
> 
>     a [==] b
>     a [<] b
>     a [>=] b
> 
> is sort of appealing <g>.
> 
> 
> 

Works for me, but then, I'm twisted.

-R

December 27, 2001
"Russell Borogove" <kaleja@estarcion.com> wrote in message news:3C2B67E5.20207@estarcion.com...

> Okay, well, then, let's get back to thinking of a good operator to use for array content comparison.
>
>     if (a $= b)     // "string equal" to speakers of BASIC

I'm a BASIC geek myself and would never ever consider
$= "string equality"...




December 27, 2001
Perl maybe?

    if (a eq b) ...
    if (a !eq b) ...


December 27, 2001
Or maybe this?

    if (a ~~ b) ...
    if (a !~ b) ...


December 27, 2001
Pavel Minayev wrote:

> Perl maybe?
>
>     if (a eq b) ...
>     if (a !eq b) ...

No, not this.  We want something that will work with comparing multidimensional arrays to an arbitrary depth, IMHO.  So I think it should be == with some sort of qualifier, such as *==,  []==, or [==]

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]


December 28, 2001
"Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3C2BA7D3.7D2ED7A@deming-os.org...
> Pavel Minayev wrote:
>
> > Perl maybe?
> >
> >     if (a eq b) ...
> >     if (a !eq b) ...
>
> No, not this.  We want something that will work with comparing multidimensional arrays to an arbitrary depth, IMHO.  So I think it should be == with some sort of qualifier, such as *==,  []==, or [==]

Too long to type. I'd prefer something not longer than 2 chars (since string comparison is a frequent operation).


December 28, 2001
I was about to suggest *=, but then it's got an overloaded meaning between multiplication-in-place and comparision, which I don't think is good:

char a[];
char b[];
int c;
a *= c;   // multiples each element by c
a *= b;   // string compares a and b

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]


December 28, 2001
"Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3C2CDA64.B13E6C78@deming-os.org...
> I was about to suggest *=, but then it's got an overloaded meaning between multiplication-in-place and comparision, which I don't think is good:
>
> char a[];
> char b[];
> int c;
> a *= c;   // multiples each element by c
> a *= b;   // string compares a and b

Definitely. For same reason I didn't suggest ~=.
For now I tend to like that ~~ thingie I proposed not long ago.
It's fast to type, consists of one character repeated twice like ==,
and associates with ~ which concats _arrays_ in contrast to +
which sums their _contents_. It also makes possible to define
a whole set of comparison ops for arrays:

    ~~    equal
    !~    not equal
    ~>    greater than
    ~<    less than
    ~>=   greater than or equal
    ~<=   less than or equal