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

Levente Uzonyi leves at caesar.elte.hu
Tue Dec 6 22:06:11 UTC 2016


On Tue, 6 Dec 2016, Tobias Pape wrote:

>
> On 06.12.2016, at 22:25, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>
>> On Tue, 6 Dec 2016, Tobias Pape wrote:
>> 
>>> 
>>> On 06.12.2016, at 21:23, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>>> 
>>>> On Tue, 6 Dec 2016, tim Rowledge wrote:
>>>>>> On 06-12-2016, at 11:08 AM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>>>>>> Is there any use of these lists? I mean besides process scheduling.
>>>>>> I can't imagine a use-case where I would use a LinkedList instead of an OrderedCollection (or another data structure).
>>>>> Anywhere that needs frequent adding and removing of items mid-list, or growing/shrinking. Saves constantly making a new array, copying gazillions of OOPs and possibly #become.
>>>> Using the current implementation, addition might be O(1) if you hold a reference to the internal list node, but removal is O(n) unless you maintain backwards pointers - aka make the list doubly-linked.
>>>> OrderedCollection is far superior in growing/shrinking (provided it's done at one of its ends), both in term of run time and memory usage, since it needs fewer objects.
>>> 
>>> Yes.
>>> 
>>> But sometimes you need a linked list.
>> 
>> Right. But whenever I do, I roll my own because
>> - most of the time I need a doubly linked list (e.g. LRUCacheHeadNode and LRUCacheNode)
>> - I already have a class hierachy to match, so I can't subclass LinkedList (see ODatedEntry in OCompletion, this is also a doubly linked list)
>> 
>>> It is not that the trunk _should_ use it but that Squeak programmers _can_ use it.
>> 
>> There must be a reason why it's not being used in the Trunk. :)
>
> So is the XMLParser, the SerialPort, the SecureSocket, the POP3Client, the PNMReadWriter, the ScaleMorph, the AsyncFile ; Regex rarely, even the Abort exception is unused

Those are just tools, not data structures. You're comparing apples to 
oranges.

>
> I always thought as Squeak as an environment, as system I can program my application into.
> If we say, bah we need no standard-library except for what is _used_ in trunk, this is moot :/

Who says that?

My point was that LinkedList in its current form is not generally useful.

Levente

>
>> 
>> Levente
>> 
>>> Let's not impose too much on the programmers. Linked lists are pretty standard :)
>>> 
>>> 
>>> Best regards
>>> 	-Tobias


More information about the Squeak-dev mailing list