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

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Oct 16 16:48:19 UTC 2017


2017-10-16 9:06 GMT+02:00 Tobias Pape <Das.Linux at gmx.de>:

>
> > On 15.10.2017, at 22:42, Nicolas Cellier <nicolas.cellier.aka.nice@
> 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
>

Ah OK, thanks,
I miss-interpreted the position of ^ and thought it would return self

>
> > +       !
> >
> > Item was added:
> > + ----- Method: Symbol class>>empty (in category 'instance creation')
> -----
> > + empty
> > +       "A canonicalized empty symbol."
> > +       ^ #''!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171016/da849145/attachment.html>


More information about the Squeak-dev mailing list