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

Dan Ingalls Dan at SqueakLand.org
Mon Apr 1 00:27:27 UTC 2002


Brian Keefer <mgomes21 at cox.net>  wrote...

>I'm guessing the reason is more involved than "because nobody asked", but
>such a capability would be nice for my dinky little LazyObject class. I
>suppose a reasonable workaround would be to force my SmallInteger into a
>Large(Positive|Negative)Integer, or make a wrapper for the SmallInteger.

My take on this is that there is no practical reason that this would not work the way I hear it being asked, namely that every reference to aNonSmallInteger would be replaced by a reference to aSmallInteger.

I think it's a reasonable request, but I can imagine uses of it that would be in questionable taste.

The concern that I hear in the other replies is that it doesn't quite feel like a become, since those references are now to an immutable object, and can't therefore experience any further change.

But it IS a forward change of identity, and it would NOT break anything.  It's not that different from mapping to nil, true, or false, concerning which I'd give the same answer.

So my answer to the original question is that, in fact, there is not much more involved than "because nobody asked".

	- Dan



More information about the Squeak-dev mailing list