[squeak-dev] SmallInteger someInstance == nil :(
Marcel Taeumel
marcel.taeumel at hpi.de
Tue Jul 21 13:08:05 UTC 2020
Maybe I can check for #isImmediateClass first :-)
Am 21.07.2020 15:07:01 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>:
Hi Fabio.
>From an object-oriented perspective, it would be nice to get "some instance" when asking a class in the system for #someInstance. :-)
As it is now, I have to start writing a little lookup table with "class == SmallInteger ifTrue: [ .... ]" to lookup exemplary instances for some classes in the system.
Best,
Marcel
Am 21.07.2020 14:53:31 schrieb Fabio Niephaus <lists at fniephaus.com>:
On Tue, Jul 21, 2020 at 2:24 PM Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> wrote:
Hi all!
Why is "SmallInteger someInstance == nil"?
Because SmallIntegers are immediate and cannot be instantiated (`SmallInteger new` fails). This implies:
"SmallFloat64 someInstance == nil"
"Character someInstance == nil"
Why would you want someInstance of SmallInteger anyway?
Fabio
Best,
Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200721/5f378a03/attachment.html>
More information about the Squeak-dev
mailing list
|