which fix is the best for Complex?

Matej Kosik kosik at fiit.stuba.sk
Sat Jun 10 20:04:19 UTC 2006


Thomas Koenig wrote:
> Steph, I recommend harvesting Nicolas cellier' fixes.  Certainly in
> preference to mine (to in elegant) and even in preference to (isNumber
> ignores issues discussed in Complex class comments.) Nicolas appears to have
> spent the time working with Complex.  Tom 
> 

Hello,

Once upon a time the `Complex' class was in a separate package called
`Algebraic'. Its intention was to brings things like complex numbers,
matrices, polynoms and such to the image. Since it was rather
incomplete, I deleted it. Later someone put these classes into the core
image.

The problem with the Complex class (and I thought that it was obvious)
is, that it cannot be implemented correctly without traits. Complex
certainly is a number (roughly) (you can do arithmetic with it, it plays
well with other numbers etc). The problem is, that it is not a magnitude
(they cannot be sensibly totally ordered).

Other things are problematic. If `Complex' is a `Number' then methods:

	to:
	to:by:
	to:by:do:
	to:do:
	even
	odd
	isDivisibleBy:
	negative
	positive
	sign
	strictlyPositive
	ceiling
	detentBy: detent atMultiplesOf: grid snap: snap
	floor
	fractionPart
	integerPart
	reduce
	roundTo:
	roundUpTo:
	rounded
	truncateTo:
	truncated

do not have sense.

Finer classification would be more appropriate, but the whole stuff
would be a bit more complicated. I am not sure if it could be done
without traits (I guess).
-- 
Matej Kosik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060610/e1bb0b55/signature.pgp


More information about the Squeak-dev mailing list