[squeak-dev] SequenceableCollection #= method in current trunk differs from Squeak 5.2

David T. Lewis lewis at mail.msen.com
Fri Jul 3 19:55:21 UTC 2020


Hello Nikolay,

On Fri, Jul 03, 2020 at 06:43:04PM +0300, Nikolay Suslov wrote:
> Hello David,
> 
> On Fri, Jul 3, 2020 at 3:43 PM David T. Lewis <lewis at mail.msen.com> wrote:
> >
> > On Mon, Jun 29, 2020 at 02:43:26AM +0200, Levente Uzonyi wrote:
> > > Hi Nikolai,
> > >
> > > On Mon, 29 Jun 2020, Nikolay Suslov wrote:
> > >
> > > >Hello all,
> > > >Figuring out, could we go back to the previous version of
> > > >SequenceableCollection??#= method (as in Squeak 5.2), to check if the
> > > >receiver is??equivalent to the otherCollection by using "self species ==
> > > >otherCollection species",
> > > >instead of "self class = otherCollection class"?
> > >
> > > IIRC there was a good reason for that change though I can't recall
> > > what it was. I'm sure the mailing list remembers.
> > >
> >
> > The change has my initials on it, and it was introduced here:
> >
> >   Name: Collections-dtl.821
> >   Author: dtl
> >   Time: 16 February 2019, 6:18:27.925895 pm
> >   UUID: 9bfa29b3-5e9f-4c61-b19b-e0bb05403589
> >   Ancestors: Collections-nice.820
> >
> >   Classes are expected to be unique in the system, but in some cases (e.g. Magma)
> >   it is also useful to expect a proxy for a class to test equivalent to the
> >   actual class. Therefore, in SequenceableCollection>>= use #= rather than #==
> >   for the class comparison.
> >
> >
> > The discussion on the list was here:
> >
> >   http://lists.squeakfoundation.org/pipermail/squeak-dev/2019-February/201600.html
> >
> > Dave
> >
> >
> 
> Thanks for finding that.
> But, if you look at the previous version (sma 5/12/2000) of
> SequenceableCollection>>=, it checks the equivalents of "species" (the
> same 'kind' of thing in collection). So, replacing that with check
> equivalents of a "class" introduces a "silent application bug",
> especially in code, which expects "species" comparison in
> SequenceableCollection>>= (like RFB I mentioned).
> Anyway, it is ok to use and upgrade related code to #hasEqualElements:
> method instead.
> But someone still can find the difference, that in Set, Bitset,
> SortedCollection we could use #= for checking equivalents of
> "species", but in SequenceableCollection - not, starting from Squeak
> 5.3
> 
> Best regards,
> Nikolai

Yes, I can see that your are right. The current version of the
SequenceableCollection>>#= does this:

   self class = otherCollection class

and the previous version (sma 5/12/2000) did this:

   self species == otherCollection species

I have to say that I am not really qualified to say what is the best
implementation, so I hope that you or others (Nicolas, Levente, Chris?)
can suggest if there is a better way.

For example, is it better to do this (I really do not know):

   self species = otherCollection species

Thanks,
Dave 


More information about the Squeak-dev mailing list