Login  Register

Re: Comparison for SequencableCollection

Posted by jtuchel on Aug 02, 2015; 12:44pm
URL: https://forum.world.st/Comparison-for-SequencableCollection-tp4840704p4840705.html

I'd say it is questonable if SequenceableCollections should be
comparable by default.

is (a b c) equal or lower than (b a c) ?
Doesn't this depend heavily on what is in the Collection and what the
meaning of the Sequence of two Collections is?

So I'd say there is not much use in putting comparisons into the base
class library, because there is a ton of assumptions about the
Collections in whatever implementation one can imagine. I would assume
that this is the job of some business object that holds objects in a
SequenceableCollection. Don't you think?

The fact that other languages provide such an implementation doesn't
mean much to me, to be honest. I choose a SequencableCollection in order
to keep objects in a certain order, nothing more, nothing less.

I think it is important to not get "overridden" by the fact that
something is extremely easy to do in Smalltalk. We can easily make bad
mistakes, just because we can.

Just my 2 cents

Joachim

Am 02.08.15 um 14:11 schrieb webwarrior:

> I was surprised when discovered that in Pharo comparison is not defined for
> lists, arrays and similar datastructures.
>
> Because in almost every programming language (F#, Python, Javascript just to
> name few) you can compare lists, arrays, etc. By convention, the ordering is
> lexicographical, just like in strings.
>
> It took little time to add needed methods to SequencableCollection, but I
> think its better to have them in core library (core image, or how do you
> call it?).
>
>
>
> --
> View this message in context: http://forum.world.st/Comparison-for-SequencableCollection-tp4840704.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1