Jump to page: 1 26  
Page
Thread overview
Array comparisons
Mar 27, 2002
Walter
Mar 27, 2002
Russell Borogove
Mar 27, 2002
Juarez Rudsatz
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
Walter
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
Immanuel Scholz
Mar 27, 2002
Sean L. Palmer
Mar 27, 2002
Pavel Minayev
Mar 28, 2002
Sean L. Palmer
Mar 28, 2002
Pavel Minayev
Mar 27, 2002
Gary
Mar 27, 2002
Juarez Rudsatz
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
Roberto Mariottini
Mar 27, 2002
Walter
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
Roberto Mariottini
Mar 27, 2002
Pavel Minayev
Apr 12, 2002
Walter
Mar 27, 2002
Immanuel Scholz
Mar 27, 2002
Sean L. Palmer
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
OddesE
Mar 28, 2002
DrWhat?
Mar 27, 2002
Juarez Rudsatz
Mar 27, 2002
Walter
Mar 28, 2002
Barry Pederson
Apr 13, 2002
Walter
Mar 27, 2002
Russ Lewis
Mar 27, 2002
Richard Krehbiel
Mar 27, 2002
Pavel Minayev
Mar 28, 2002
Sean L. Palmer
Mar 28, 2002
Pavel Minayev
Mar 28, 2002
Rchard Krehbiel
Apr 16, 2002
Walter
Apr 16, 2002
Richard Krehbiel
Apr 16, 2002
Walter
Apr 17, 2002
Russell Borogove
Apr 17, 2002
Walter
Apr 17, 2002
Roberto Mariottini
Apr 17, 2002
Karl Bochert
Apr 17, 2002
Stephen Fuld
Apr 17, 2002
Pavel Minayev
Apr 17, 2002
Sean L. Palmer
Apr 17, 2002
Pavel Minayev
Mar 27, 2002
OddesE
Mar 28, 2002
Pavel Minayev
Mar 27, 2002
Stephen Fuld
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
Stephen Fuld
Mar 27, 2002
OddesE
Apr 17, 2002
Walter
Apr 18, 2002
OddesE
Apr 19, 2002
Walter
March 27, 2002
I've been reading all the messages on string comparisons, and propose the following:

Since <, <=, >, >= make little sense on dynamic array references, those are by value. Introduce two new operators, === and !==, to do a by-value comparison for arrays. Similarly, for class objects, == and != will compare the references, and === and !== will call the equals() function in the Object base class.


March 27, 2002
Walter wrote:
> I've been reading all the messages on string comparisons, and propose the
> following:
> 
> Since <, <=, >, >= make little sense on dynamic array references, those are
> by value. Introduce two new operators, === and !==, to do a by-value
> comparison for arrays. Similarly, for class objects, == and != will compare
> the references, and === and !== will call the equals() function in the
> Object base class.

I'd strongly prefer the other way around -- use value semantics
for == and !=, and reference semantics for === and !==.

-Russell B


March 27, 2002
Walter <walter@digitalmars.com> wrote in message news:a7r7ok$1ing$2@digitaldaemon.com...
> I've been reading all the messages on string comparisons, and propose the following:
>
> Since <, <=, >, >= make little sense on dynamic array references, those
are
> by value. Introduce two new operators, === and !==, to do a by-value comparison for arrays. Similarly, for class objects, == and != will
compare
> the references, and === and !== will call the equals() function in the
> Object base class.
>
>

Sounds great... when do you expect we may see it in action?

Gary.


March 27, 2002
Russell Borogove <kaleja@estarcion.com> wrote in news:3CA124F2.1010802@estarcion.com:

> Walter wrote:
>> I've been reading all the messages on string comparisons, and propose the following:

> I'd strongly prefer the other way around
> -- use value semantics
> for == and !=,
> and reference semantics for === and !==.
> 
> -Russell B

2 votes.

Programmer will need much more comparating values of arrays than references. Compare the statistics of use and choose the implementation.

March 27, 2002
"Walter" <walter@digitalmars.com> wrote in news:a7r7ok$1ing$2@digitaldaemon.com:

> Since <, <=, >, >= make little sense on dynamic array references, those are
> 

I dont know why ?
Strings comparation dont is a good example ?

J.
March 27, 2002
"Juarez Rudsatz" <juarez@correio.com> wrote in message news:Xns91DDEEF3F4733juarezcom@63.105.9.61...

> > Since <, <=, >, >= make little sense on dynamic array references, those are
> >
>
> I dont know why ?
> Strings comparation dont is a good example ?

Array _references_, not contents.
When you compare strings, you compare contents.


March 27, 2002
"Juarez Rudsatz" <juarez@correio.com> wrote in message news:Xns91DDEEB1A3B8Ejuarezcom@63.105.9.61...

> 2 votes.
>
> Programmer will need much more comparating values of arrays than
references.
> Compare the statistics of use and choose the implementation.

Agreed (so 3 already).

However, I wouldn't really mind if it was vice versa. I just like comparison by value to be default more.


March 27, 2002
"Russell Borogove" <kaleja@estarcion.com> wrote in message news:3CA124F2.1010802@estarcion.com...
> Walter wrote:
> > Since <, <=, >, >= make little sense on dynamic array references, those
are
> > by value. Introduce two new operators, === and !==, to do a by-value comparison for arrays. Similarly, for class objects, == and != will
compare
> > the references, and === and !== will call the equals() function in the
> > Object base class.
> I'd strongly prefer the other way around -- use value semantics for == and !=, and reference semantics for === and !==.

That idea has great merit, but I worry that == being a reference comparison for, say, Object references, would just cause too much confusion.


March 27, 2002
"Walter" <walter@digitalmars.com> ha scritto nel messaggio news:a7r7ok$1ing$2@digitaldaemon.com...
> I've been reading all the messages on string comparisons, and propose the following:
>
> Since <, <=, >, >= make little sense on dynamic array references, those
are
> by value. Introduce two new operators, === and !==, to do a by-value comparison for arrays. Similarly, for class objects, == and != will
compare
> the references, and === and !== will call the equals() function in the
> Object base class.

Two questions:

1 - Waht about assignment?

    Object1 a;
    Object1 b;

    a = b;  // by-reference assignment
    ????    // by-value assignment?

2 - What about integrating this syntax with pointers? Like this:
    int *p;
    int *q;
    ...
    ----
    if (p === q)
      ...
    ----
       is the same as  :
    ----
    if (*p == *q)
      ...
    ----

Ciao


March 27, 2002
"Roberto Mariottini" <rmariottini@lycosmail.com> wrote in message news:a7rutn$1va1$1@digitaldaemon.com...
> 1 - Waht about assignment?
>
>     Object1 a;
>     Object1 b;
>
>     a = b;  // by-reference assignment
>     ????    // by-value assignment?

I was thinking of a dup() method in Object.

> 2 - What about integrating this syntax with pointers? Like this:
>     int *p;
>     int *q;
>     ...
>     ----
>     if (p === q)
>       ...
>     ----
>        is the same as  :
>     ----
>     if (*p == *q)

Yes, that would be consistent.


« First   ‹ Prev
1 2 3 4 5 6