Jump to page: 1 212  
Page
Thread overview
[Again] One big isue before 1.0
Aug 07, 2004
Ivan Senji
Aug 07, 2004
Ant
Aug 07, 2004
Maik Zumstrull
Aug 07, 2004
Ivan Senji
Aug 07, 2004
Ivan Senji
Aug 07, 2004
Ant
Aug 07, 2004
Walter
Aug 08, 2004
davepermen
Aug 09, 2004
Walter
Aug 09, 2004
davepermen
Aug 09, 2004
Walter
Aug 10, 2004
davepermen
Aug 07, 2004
Ben Hinkle
Aug 07, 2004
Walter
Aug 07, 2004
Ivan Senji
Aug 07, 2004
Lars Ivar Igesund
Aug 08, 2004
Ivan Senji
Aug 09, 2004
Matthew
Aug 23, 2004
Charles Hixson
Aug 09, 2004
Walter
Aug 09, 2004
Regan Heath
Aug 09, 2004
Walter
Aug 18, 2004
Sha Chancellor
Aug 09, 2004
Stewart Gordon
Aug 09, 2004
Stewart Gordon
Aug 09, 2004
Russ Lewis
Aug 09, 2004
Andy Friesen
Aug 10, 2004
Stewart Gordon
Aug 10, 2004
Andy Friesen
Aug 10, 2004
Stewart Gordon
Aug 10, 2004
Andy Friesen
Aug 10, 2004
Stewart Gordon
Aug 10, 2004
Andy Friesen
Aug 10, 2004
Stewart Gordon
Aug 07, 2004
Andy Friesen
Aug 07, 2004
Ben Hinkle
Aug 07, 2004
Ivan Senji
Aug 07, 2004
Arcane Jill
Aug 07, 2004
Stratus
Aug 07, 2004
Andy Friesen
Aug 07, 2004
Lars Ivar Igesund
Aug 07, 2004
Ivan Senji
Aug 09, 2004
Stewart Gordon
Aug 17, 2004
Ivan Senji
Aug 22, 2004
Stewart Gordon
Aug 22, 2004
Ivan Senji
Aug 22, 2004
Stewart Gordon
Aug 22, 2004
Andy Friesen
Aug 22, 2004
Arcane Jill
Aug 22, 2004
antiAlias
Aug 22, 2004
Andy Friesen
Aug 23, 2004
Matthew
Aug 23, 2004
Daniel Horn
Aug 23, 2004
Matthew
Aug 23, 2004
Ivan Senji
Pre 1.0 concerns. (Was Re: [Again] One big isue before 1.0)
Aug 23, 2004
Matthew
Aug 23, 2004
Ivan Senji
Aug 23, 2004
Daniel Horn
Aug 23, 2004
Andy Friesen
Aug 23, 2004
Daniel Horn
Aug 23, 2004
Arcane Jill
Aug 23, 2004
Matthew
Aug 24, 2004
Arcane Jill
Aug 25, 2004
Matthew
Aug 23, 2004
Dave
Sep 04, 2004
Ilya Minkov
Aug 23, 2004
antiAlias
Aug 23, 2004
Sean Kelly
Re: Pre 1.0 concerns
Aug 25, 2004
antiAlias
Re: Pre 1.0 concerns.
Aug 25, 2004
Lars Ivar Igesund
Sep 05, 2004
Ilya Minkov
Sep 05, 2004
h3r3tic
Sep 05, 2004
Andy Friesen
Sep 05, 2004
antiAlias
Sep 05, 2004
Ben Hinkle
Sep 05, 2004
Ilya Minkov
Sep 06, 2004
Andy Friesen
Sep 06, 2004
Stewart Gordon
Sep 06, 2004
Ilya Minkov
Sep 06, 2004
Stewart Gordon
Sep 06, 2004
Ilya Minkov
bit[] (was Pre 1.0 concerns.)
Sep 06, 2004
Arcane Jill
Sep 06, 2004
Ben Hinkle
Sep 06, 2004
Ilya Minkov
Sep 06, 2004
Ben Hinkle
Sep 06, 2004
antiAlias
Sep 06, 2004
Ben Hinkle
Sep 06, 2004
antiAlias
Sep 07, 2004
Arcane Jill
Sep 07, 2004
Ivan Senji
Sep 06, 2004
Arcane Jill
Sep 06, 2004
Joel Salomon
Cross-OS-Binary? (was Pre 1.0 concerns.)
Sep 06, 2004
Arcane Jill
Sep 06, 2004
Martin
Sep 06, 2004
Derek Parnell
Sep 07, 2004
Sean Kelly
Sep 07, 2004
Derek Parnell
Sep 07, 2004
Sean Kelly
Sep 07, 2004
Derek Parnell
Sep 07, 2004
Sean Kelly
Aug 08, 2004
teqDruid
Aug 08, 2004
Arcane Jill
Aug 08, 2004
Ben Hinkle
Aug 08, 2004
Nick
Aug 08, 2004
Ivan Senji
Aug 09, 2004
Nick
Aug 09, 2004
Stewart Gordon
Aug 09, 2004
Nick
Aug 09, 2004
Matthew
Aug 09, 2004
Nick
Aug 09, 2004
Stewart Gordon
Aug 09, 2004
Stewart Gordon
August 07, 2004
There are bigger problems but:

Can please these:
    int opCmp(Object o);
    int opEquals(Object o);

be removed from Object!

No one uses them (i guess) (except AAs but i believe
this can be changed!) and they can cause a lot of problems!

Isn't it time to get rid of them?


August 07, 2004
On Sat, 07 Aug 2004 13:02:40 +0200, Ivan Senji wrote:

> There are bigger problems but:
> 
> Can please these:
>     int opCmp(Object o);
>     int opEquals(Object o);
> 
> be removed from Object!
> 
> No one uses them (i guess) (except AAs but i believe
> this can be changed!) and they can cause a lot of problems!
> 
> Isn't it time to get rid of them?

I use them!

How else can an array of objects be sorted?
what problems do they cause?

Ant

August 07, 2004
Ant schrieb:

>> Can please these:
>>     int opCmp(Object o);
>>     int opEquals(Object o);
>> 
>> be removed from Object!
>> 
>> No one uses them (i guess) (except AAs but i believe
>> this can be changed!) and they can cause a lot of problems!
>> 
>> Isn't it time to get rid of them?
> 
> I use them!

And why not?

> How else can an array of objects be sorted?

Have a look at Java's "Comparable" Interface. Their util.Arrays.sort() can use it. It works, but that's about it. Ugly to use, even uglier to implement. I think operator overloading is a much nicer approach than "Interfaces for everything".

> what problems do they cause?

People who still think in plain C get confused.
August 07, 2004
"Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.08.07.11.23.04.166202@yahoo.ca...
> On Sat, 07 Aug 2004 13:02:40 +0200, Ivan Senji wrote:
>
> > There are bigger problems but:
> >
> > Can please these:
> >     int opCmp(Object o);
> >     int opEquals(Object o);
> >
> > be removed from Object!
> >
> > No one uses them (i guess) (except AAs but i believe
> > this can be changed!) and they can cause a lot of problems!
> >
> > Isn't it time to get rid of them?
>
> I use them!

I use them too, but i wish that finally they are not automatically defined for every class!

> How else can an array of objects be sorted?
> what problems do they cause?

Problems are: I write a class or struct and by accident forget to declare these operators, and if i pass my type to a template using == or < on this type the compiler will not complain but use the default ones from object!

In the newer versions of DMD object doesn't define these operators, it only declares them, but this is still legal:

class A{}

A a,b;
a = new A;
b = new A;

if(a==b)...
if(a<b)...

IMO this shouldn't work because i didn't write these operators!

And additionally i may wan't my class objects to be incomparable, and this is not possible now.

> Ant
>


August 07, 2004
"Maik Zumstrull" <Maik.Zumstrull@gmx.de> wrote in message news:cf2h7n$1q95$1@digitaldaemon.com...
> Ant schrieb:
>
> >> Can please these:
> >>     int opCmp(Object o);
> >>     int opEquals(Object o);
> >>
> >> be removed from Object!
> >>
> >> No one uses them (i guess) (except AAs but i believe
> >> this can be changed!) and they can cause a lot of problems!
> >>
> >> Isn't it time to get rid of them?
> >
> > I use them!
>
> And why not?
>
> > How else can an array of objects be sorted?
>
> Have a look at Java's "Comparable" Interface. Their util.Arrays.sort() can use it. It works, but that's about it. Ugly to use, even uglier to implement. I think operator overloading is a much nicer approach than "Interfaces for everything".
>
> > what problems do they cause?
>
> People who still think in plain C get confused.

I am confused becouse i am thinking in 'plain' C++: (not C)
If i don't write an operator i don't want it to magically be there :(


August 07, 2004
On Sat, 07 Aug 2004 14:36:15 +0200, Ivan Senji wrote:

> "Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.08.07.11.23.04.166202@yahoo.ca...
>> On Sat, 07 Aug 2004 13:02:40 +0200, Ivan Senji wrote:
>>
>> > There are bigger problems but:
>> >
>> > Can please these:
>> >     int opCmp(Object o);
>> >     int opEquals(Object o);
>> >
>> > be removed from Object!
> 
> Problems are:

ahh... wasn't it called cmp(Object)
(and equals(Object)?)?

why did it change?

Ant

August 07, 2004
Ivan Senji wrote:

> "Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.08.07.11.23.04.166202@yahoo.ca...
>> On Sat, 07 Aug 2004 13:02:40 +0200, Ivan Senji wrote:
>>
>> > There are bigger problems but:
>> >
>> > Can please these:
>> >     int opCmp(Object o);
>> >     int opEquals(Object o);
>> >
>> > be removed from Object!
>> >
>> > No one uses them (i guess) (except AAs but i believe
>> > this can be changed!) and they can cause a lot of problems!
>> >
>> > Isn't it time to get rid of them?
>>
>> I use them!
> 
> I use them too, but i wish that finally they are not automatically defined for every class!
>
>> How else can an array of objects be sorted?
>> what problems do they cause?
> 
> Problems are: I write a class or struct and by accident forget to declare these operators, and if i pass my type to a template using == or < on this type the compiler will not complain but use the default ones from object!

That's exactly what I would expect it to do. One person's bug is another's
feature.

> In the newer versions of DMD object doesn't define these operators, it only declares them, but this is still legal:
> 
> class A{}
> 
> A a,b;
> a = new A;
> b = new A;
> 
> if(a==b)...
> if(a<b)...
> 
> IMO this shouldn't work because i didn't write these operators!

By that argument we shouldn't have anything in Object since you don't seem
to want to inherit any behavior automatically.

> And additionally i may wan't my class objects to be incomparable, and this is not possible now.

Then throw an exception in opCmp - sure it's run-time but incomparability is presumably very rare.

>> Ant
>>

August 07, 2004
i think walter added "op" to the front of all the operator functions to
avoid name conflicts (they used to be things like add(), mul() etc.  and now
they're opAdd(), opMul()).  personally i don't see what's wrong with
operator+() , but oh well.


August 07, 2004
Ivan Senji wrote:

> There are bigger problems but:
> 
> Can please these:
>     int opCmp(Object o);
>     int opEquals(Object o);
> 
> be removed from Object!
> 
> No one uses them (i guess) (except AAs but i believe
> this can be changed!) and they can cause a lot of problems!
> 
> Isn't it time to get rid of them?

Yes.

Anything Object defines, *everything* defines, and, when it's something as broad as this, it sucks.

The wost part is what exactly Object's behaviour is: the default opCmp effectively generates a random number for each object, and yields a comparison between those.  If this isn't abuse of overloaded operators, what is?

All it would take, as far as I can tell, is to change TypeInfoClass to compare hash codes instead of calling opCmp and opEquals.  Lucky for us, this means that Object can still be sorted in an array and used as an AA key while making comparison operators raise a compile time error. Everybody wins.

If nothing else, this would go a huge way toward disambiguating == and != from === and !==.  Using the former on most object references would be a compile error.

 -- andy
August 07, 2004
"Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cf2ibj$1qnr$1@digitaldaemon.com...
> And additionally i may wan't my class objects to be incomparable, and this is not possible now.

Just put an assert(0) in the opCmp() overload for your class.


« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11