[squeak-dev] Complex isNumber

stephane ducasse stephane.ducasse at free.fr
Wed Mar 12 07:35:46 UTC 2008


Nicolas
I always thought that the complex class was plain bad. Can I infer  
from your email
that I was wrong and that it is worth keeping it?

Stef

On Mar 11, 2008, at 10:58 PM, nicolas cellier wrote:

>
> Though my advice was to keep this change out of the image, it came  
> in 3.9 or 3.10, i don't know...
> Complex isNumber allows a lightweight fix of Number = Complex bug.
>
> BUT TOO MUCH CODE RELY ON A DIFFERENT BEHAVIOUR!
>
> In less of one minute of browsing, i can construct a fail test like:
>
> self shouldnt: [Dictionary at: 1 i  put: 'a complex number'; at: 2  
> put: 'a number'; explore] raise: Error
>
> Guess what, the failing method is called keysSortedSafely... But  
> with this change in, nothing that was safe yesterday will be safe  
> again ;-).
>
>
>
> I recommend AGAIN to browse senders of isNumber and find maybe the  
> one or two that are prepared for an instance of Complex.
>
> MOST are expecting (isKindOf: Number), and not any number out of the  
> set of real numbers.
>
> This is consistent with traditional Smalltalk implementation, all  
> subInstances of Number are in the set of real
> (well except Float nan and Float infinity which were not in St-80).
>
>
>
> I proposed isNumberExtension so that other Number extensions like  
> Quaternion can be added too without a rewrite (http://bugs.squeak.org/view.php?id=2688 
> ).
>
> This had no success, maybe the selector is not very well chosen...
> I don't care, call it what you want, but please, not isNumber,
>
>
>
> The bugs are minor, because fortunately, Complex are hardly ever  
> used, so we can as well let this change rot in the image as is.
>
> Personnally, i vote thumb down.
>
> Nicolas
>
>
>




More information about the Squeak-dev mailing list