Why D is annoying =P

Dejan Lekic dejan.lekic at gmail.com
Thu Oct 25 06:56:58 PDT 2012


On Thursday, 25 October 2012 at 02:12:58 UTC, Jonathan M Davis 
wrote:
> On Wednesday, October 24, 2012 13:31:14 Walter Bright wrote:
>> The default compare for structs is a bit compare of the 
>> contents.
>
> Which definitely seems inherently broken. Doing that only works 
> if the struct
> only contains integral types, character types, or bool. Nothing 
> else will
> compare properly that way. It really needs to work like arrays 
> do (or are
> supposed to anyway) and compare each member according to == and 
> only fallback
> to an outright bitwise compare when it knows that the results 
> would be
> identical (i.e. because all of the members are integral types, 
> character
> types, bool, or other structs which hold only integral types, 
> character types,
> or bool - be it directly or in other structs that they hold). 
> Bitwise comparison
> is the is operator's job, not ==.
>
> - Jonathan M Davis

+1
I can only agree with this. People who monitor the NG know about 
the problem but it is probably very confusing to D newbies.


More information about the Digitalmars-d mailing list