[Pharo-project] is there an easy way to know the SmallInteger instances?
bschwab at anest.ufl.edu
Mon Nov 22 00:58:50 CET 2010
But by iterating over all small integers, are you not "instantiating" ones that were not in use? Dr. Heisenberg will get a good grin out this one :)
From: pharo-project-bounces at lists.gforge.inria.fr [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of Eliot Miranda [eliot.miranda at gmail.com]
Sent: Sunday, November 21, 2010 6:10 PM
To: Pharo-project at lists.gforge.inria.fr
Subject: Re: [Pharo-project] is there an easy way to know the SmallInteger instances?
So you could implement
^self maxVal - self minVal + 1
^self minVal to: self maxVal
you could implement the following but it's of academic interest only; it'll take a long time on a 64-bit implementation ;) If you add this then you have to guard against it being invoked because shure as s**t someone will wonder why the system isn't doing anything when they ask some apparently reasonable question about instance counts...
SmallInteger class>>allInstancesDo: aBlock
self minVal to: self maxVal do: aBlock
More information about the Pharo-project