Thread overview
Default opCmp() for classes
Apr 06, 2005
Uwe Salomon
Apr 06, 2005
Stewart Gordon
Apr 07, 2005
Matthew
April 06, 2005
Hello,

what exactly is the reason for the existence of a default opCmp() for classes? Every class that an opCmp() really makes sense for has to implement it anyways, and the others don't want to be compared i guess. If there weren't a standard implementation (or the standard would only throw an exception) this would help detecting programming errors. Or is the operator necessary for the AA-implementation?

Ciao
uwe
April 06, 2005
Uwe Salomon wrote:
> Hello,
> 
> what exactly is the reason for the existence of a default opCmp() for  classes? Every class that an opCmp() really makes sense for has to implement it anyways, and the others don't want to be compared i guess. If there weren't a standard implementation (or the standard would only throw an exception) this would help detecting programming errors. Or is the operator necessary for the AA-implementation?

I'm not sure if anyone knows the original reason for putting it in.  And several of us have been wanting to get rid of it for ages.

http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/10558

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
April 07, 2005
"Uwe Salomon" <post@uwesalomon.de> wrote in message news:opsotlm9jm6yjbe6@sandmann.maerchenwald.net...
> Hello,
>
> what exactly is the reason for the existence of a default opCmp() for  classes? Every class that an opCmp() really makes sense for has to  implement it anyways, and the others don't want to be compared i guess. If  there weren't a standard implementation (or the standard would only throw  an exception) this would help detecting programming errors. Or is the  operator necessary for the AA-implementation?

I think you have it right. FWIW, it's a very unpopular feature.