[squeak-dev] The Inbox: Chronology-Core-dtl.56.mcz

Levente Uzonyi leves at caesar.elte.hu
Sun Sep 6 12:19:21 UTC 2020


Hi Dave,

On Sat, 5 Sep 2020, David T. Lewis wrote:

>
> I moved Chronology-Core-dtl.56 to the treated inbox, and put
> Chronology-Core-dtl.58 in the inbox to address the #oneDay issue.

Duration class >> #zero is similar to #oneDay in the sense that it's a 
single instance in Squeak. It would be worth keeping it that way, as 
existing users use it quite liberally.

Now that we support read-only objects, I think these shared objects should 
be made read-only as well (#beReadOnlyObject). Something like this:

Duration class >> #initialize

 	"Duration oneDay is used in Date creation, and is cached to allow sharing the instance."
 	(OneDay := self days: 1) beReadOnlyObject.
 	"Duration zero is used in various comparisons and computations, and is cached to allow reusing the instance."
 	(Zero := self seconds: 0 nanoSeconds: 0) beReadOnlyObject.
 	"The following recompilation is only needed during the transition from pool variables to class variables."
 	self class
 		recompile: #oneDay;
 		recompile: #zero


Levente

>
> Dave


More information about the Squeak-dev mailing list