Why can't I do (aNonSmallInteger becomeFoward: aSmallInteger)?

Alan Kay Alan.Kay at squeakland.org
Sun Mar 31 19:09:39 UTC 2002


Perhaps you could use a float as your value for the WordInteger 
class, then coerce it when needed.

Cheers,

Alan

-----

At 10:27 AM -0800 3/31/02, Tim Rowledge wrote:
>Because a SmallInteger is a manifest constant and the oop _is_ the
>value. #become: swaps the values refered to by the oop - if the oop is
>the value, it can't be swapped.
>
>You could concievably get the results you want by making a large integer
>(which is not a manifest constant) but remember that largeintegers work
>quite hard to become SmallIntegers any time you send them any sort of
>arithmetic message. You'd probably want to implement a WordInteger class
>to get around this, or you could try living with an ugly hack like
>simply using a size 4 ByteArray.
>
>tim


-- 



More information about the Squeak-dev mailing list