[squeak-dev] The Trunk: Collections-topa.764.mcz

Tobias Pape Das.Linux at gmx.de
Mon Oct 16 07:06:14 UTC 2017


> On 15.10.2017, at 22:42, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> 
> 
> 
> 2017-10-14 13:28 GMT+02:00  <commits at source.squeak.org>:
> Tobias Pape uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-topa.764.mcz
> 
> ==================== Summary ====================
> 
> Name: Collections-topa.764
> Author: topa
> Time: 14 October 2017, 1:30:58.746815 pm
> UUID: 8b1c780c-c4fb-4a8c-baac-050c5a3e67c2
> Ancestors: Collections-pre.763
> 
> Improve #initializedInstance and #empty for certain collections
> 
> =============== Diff against Collections-pre.763 ===============
> 
> Item was added:
> + ----- Method: Bitset class>>initializedInstance (in category 'instance creation') -----
> + initializedInstance
> +
> +       ^ self new: 0!
> 
> Item was added:
> + ----- Method: ByteArray class>>empty (in category 'instance creation') -----
> + empty
> +       "A canonicalized empty ByteArray instance."
> +       ^ #[]!
> 
> Item was added:
> + ----- Method: NonPointersOrderedCollection class>>initializedInstance (in category 'instance creation') -----
> + initializedInstance
> +       " There are no instances of me, just my subclasses "
> +       ^ self ~~ NonPointersOrderedCollection ifTrue: [super initializedInstance]
> 
> Hi Tobias,
> if there is no instances, shouldn't the message fail?

No, it should return nil:

See last sentence of Comment in Behavior>>initializedInstance
	"Answer an instance of the receiver which in some sense is initialized.  In the case of Morphs, this will yield an instance that can be attached to the Hand after having received the same kind of basic initialization that would be obtained from an instance chosen from the 'new morph' menu.   Return nil if the receiver is reluctant for some reason to return such a thing"

	^ self new

Best regards
	-Tobias
> 
> +       !
> 
> Item was added:
> + ----- Method: Symbol class>>empty (in category 'instance creation') -----
> + empty
> +       "A canonicalized empty symbol."
> +       ^ #''!



More information about the Squeak-dev mailing list