Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003540 [Squeak] Kernel minor always 05-05-06 17:32 07-15-06 11:52
Reporter Tom Koenig View Status public  
Assigned To
Priority normal Resolution duplicate  
Status closed   Product Version 3.9
Summary 0003540: ComplexTest>>testEquality errored in 3.9 7025 ; fix attached
Description ComplexTest>>testEquality errored in 3.9 7025 because of a number of additional assertions about testing against nil, fractions, floats, integers that had recently been added. This cs fixes the problem. Basically 'we can not assume 'number = nonnumber' is false. It is false except in one case: complex numbers.
Also added tests to the related test classes such as Float test to protect them against regression of this behavior.
Finally, extened ScaledDecimal so it has the same treatment of Complex numbers as the other number subclasses.
Additional Information This functionality might make an excellent candidate for trying out the value of Traits. Lots of behavior that can't be shared by inheritance but needs to be common between Number subclasses and Complex.
Attached Files  ComplexFixes.1.cs.gz [^] (1,603 bytes) 05-05-06 17:32

- Relationships

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

related to 0004262closed KenCausey SUnit test ComplexTest>>testEquality fails for an collection 
related to 0003725closed  [FIX] ComplexTest>>testEquality 
related to 0004261closed  SUnit test ComplexTest>>testEquality fails for nil 
related to 0003311new  Complex Numbers are Wacky 

- Notes
(0004888 - 142 - 166 - 292 - 292 - 292 - 292)
nicolas cellier
05-07-06 20:21

Hi Tom

This was http://bugs.impara.de/view.php?id=2688 [^]

I must also compare numbers to other extensions: i have Quaternion in my image...
 
(0004890 - 1253 - 1373 - 1751 - 1751 - 1751 - 1751)
nicolas cellier
05-08-06 10:32

The idea is to retry with a coercing message.
#equalToComplex: is certainly not the one i would choose:
it implies that Integer Float etc... know very well that the only possible extension is Complex,
- something not very well encapsulated (Number knowing of Complex and only Complex),
- not extensible (remember i have quaternion),
- and not very well constructed (passing a Number as argument of equalToComplex: ).
#equalToNumber: would be far better in my opinion.

We already have default coercing messages: #adaptToFloat:andSend:
or better #adaptToFloat:andCompare: from http://bugs.impara.de/view.php?id=3374 [^]

But these ones would not work well with current implementation...
0.0 = nil would fail, and 0.0 = #(0) would answer #(true)...

So, either you replace the test isNumber with isNumberExtension as i suggested in http://bugs.impara.de/view.php?id=2688 [^] patch,
or you create a new equalToNumber: extension sent from within Number,
and equalToComplex: from within complex (and you're getting closer to VW double dispatching solution).

Remember that you also have to solve equality transitivity problem like proposed in http://bugs.impara.de/view.php?id=3374 [^]

It's good to have several solutions, but now how do we choose ?
 
(0004893 - 494 - 522 - 522 - 522 - 522 - 522)
Tom Koenig
05-09-06 01:14

Nicolas,
First of all let me appologize for not having seen the other report. When I started this "lets fix all the failing tests" effort I wasn't too good at searching Mantis.
Second let me agree that your solution is much better for the reasons you give. It's always good to see a better way.
So, I recommend to the harvesters that they accept your Patch and close my bug report. My cs did add a couple of tests that protected the number classes, so I may submit them as a separate item.
 
(0005152 - 93 - 99 - 99 - 99 - 99 - 99)
DF
06-01-06 01:19

Nicolas, I didn't saw your bug fix too. oops.
I agree with Tom that your solution is better.
 
(0005929 - 42 - 42 - 42 - 42 - 42 - 42)
MarcusDenker
07-15-06 11:52

duplicate, better solution has been posted
 

- Issue History
Date Modified Username Field Change
05-05-06 17:32 Tom Koenig New Issue
05-05-06 17:32 Tom Koenig File Added: ComplexFixes.1.cs.gz
05-07-06 20:21 nicolas cellier Note Added: 0004888
05-08-06 10:32 nicolas cellier Note Added: 0004890
05-09-06 01:14 Tom Koenig Note Added: 0004893
06-01-06 01:19 DF Note Added: 0005152
07-15-06 11:43 MarcusDenker Relationship added related to 0004262
07-15-06 11:52 MarcusDenker Status new => closed
07-15-06 11:52 MarcusDenker Note Added: 0005929
07-15-06 11:52 MarcusDenker Resolution open => duplicate
07-15-06 11:52 MarcusDenker Fixed in Version  => 3.9
07-15-06 11:54 MarcusDenker Relationship added related to 0003725
07-15-06 11:55 MarcusDenker Relationship added related to 0004261
07-15-06 11:57 MarcusDenker Relationship added related to 0003311


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
73 total queries executed.
49 unique queries executed.
Powered by Mantis Bugtracker