On 14 Apr 2015, at 14:00, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Peter,
On 14 Apr 2015, at 13:52, Peter Uhnák <i.uhnak@gmail.com> wrote:
I was surprised to learn that DoubleLinkedList is descendant of Object, while LinkedList is descendant of SequencableCollection. Is there a particular reason behind this? Are they really so conceptually different that DLL is not even considered a collection?
Thanks, Peter
DoubleLinkedList was added to help the implementation of [LRU|TTL]Cache. It was kept small and independent.
Inheriting from [Sequenceable]Collection is a larger responsibility, entails more requirements.
I would not be against this, although I am not 100% sure it is easy (some methods return the link nodes, not the elements, a distinction unknown to collections in general - LinkedList is a bit ugly in this respect too). In any case, it would have to be supported by enough tests. It could be a nice project for Pharo 5.
One problem with LinkedList is that it is used by the scheduler and carefully written to be intererrupt-check free in some (undocumented) cases⦠in the past this has already lead to very bad side-effects when people wanted to improve it or change it. Marcus