<div dir="ltr">Yes. I first tried to subclass LinkedList, but I had some trouble with funny behaviours turning up in <span style="font-family: georgia,serif;">do:,</span> although I suppose that has probably been eliminated here by using not trying to use <span style="font-family: georgia,serif;">super do:</span> as I did. (By &quot;funny&quot; I mean ending up calling element on the result of element).<br>
<br><div class="gmail_quote">On Mon, Jul 28, 2008 at 10:04 PM, nicolas cellier <span dir="ltr">&lt;<a href="mailto:ncellier@ifrance.com">ncellier@ifrance.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Marcin Tustin a écrit :<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am aware of LinkedList. It does not meet the criterion of accepting items whatever their protocol.<br>
<br>
</blockquote>
<br></div>
You are right, current implementation of LinkedList is very specialized and restricted.<br>
Creating Links transparently would be a plus.<br>
Hey, we can use a Dictionary without being aware of Association!<br>
<br>
I am not aware of such implementation, but wouldn&#39;t be surprised it already exists. Rather than a long research, it is easier to DIY.<br>
<br>
I provide an untested quick first implementation as an example.<br>
This implementation uses already existing StackLink transparently.<br>
This could of course be completed with addLink: removeLink: etc...<br>
<br>
Reading code enabled me finding <a href="http://bugs.squeak.org/view.php?id=7136" target="_blank">http://bugs.squeak.org/view.php?id=7136</a><br>
<br>
So a prerequisite is:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Installer mantis ensureFix: 7136.<br>
<br>
Last, as all code I publicly released in Squeak until now, consider this code as MIT. Change it, republish it, sell it or throw it away at will.<br>
<br>
Cheers<br><font color="#888888">
<br>
Nicolas<br>
</font><br>&#39;From Squeak3.10beta of 22 July 2007 [latest update: #7159] on 28 July 2008 at 10:48:46 pm&#39;!<br>
LinkedList subclass: #TransparentLinkedList<br>
 &nbsp; &nbsp; &nbsp; &nbsp;instanceVariableNames: &#39;&#39;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;classVariableNames: &#39;&#39;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;poolDictionaries: &#39;&#39;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;category: &#39;Collections-Sequenceable&#39;!<br>
!TransparentLinkedList commentStamp: &#39;nice 7/28/2008 21:47&#39; prior: 0!<br>
I represent a collection of links, which are containers for other objects. Using the message sequence addFirst:/removeLast causes the receiver to behave as a stack; using addLast:/removeFirst causes the receiver to behave as a queue.<br>

<br>
Unlike super, users won&#39;t see the Link objects, like users of Dictionary do not need to know about Association.<br>
That&#39;s why i am called TransparentLinkedList.!<br>
<br>
<br>
!TransparentLinkedList methodsFor: &#39;adding&#39; stamp: &#39;nice 7/28/2008 22:47&#39;!<br>
add: anObject after: otherObject<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Add anObject after otherObject in the list. Answer anObject.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;If otherObject is not in the list, then raise an error.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;| otherLink |<br>
 &nbsp; &nbsp; &nbsp; &nbsp;otherLink := self findLinkFor: otherObject ifAbsent: [^self error: &#39;otherObject is not in this list&#39;].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;super add: (StackLink with: anObject) after: otherLink.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^anObject! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;adding&#39; stamp: &#39;nice 7/28/2008 22:47&#39;!<br>
add: anObject before: otherObject<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Add anObject after otherObject in the list. Answer anObject.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;If otherObject is not in the list, then raise an error.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;| otherLink |<br>
 &nbsp; &nbsp; &nbsp; &nbsp;otherLink := self findLinkFor: otherObject ifAbsent: [^self error: &#39;otherObject is not in this list&#39;].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;super add: (StackLink with: anObject) before: otherLink.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^anObject! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;adding&#39; stamp: &#39;nice 7/28/2008 21:54&#39;!<br>
addFirst: anObject<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Add anObject to the beginning of the receiver&#39;s list. Answer anObject.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;super addFirst: (StackLink with: anObject).<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^anObject! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;adding&#39; stamp: &#39;nice 7/28/2008 21:53&#39;!<br>
addLast: anObject<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Add anObject to the end of the receiver&#39;s list. Answer anObject.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;super addLast: (StackLink with: anObject).<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^anObject! !<br>
<br>
<br>
!TransparentLinkedList methodsFor: &#39;removing&#39; stamp: &#39;nice 7/28/2008 22:11&#39;!<br>
remove: anObject ifAbsent: aBlock<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Remove anObject from the receiver. If it is not there, answer the result of<br>
 &nbsp; &nbsp; &nbsp; &nbsp;evaluating aBlock.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;| aLink |<br>
 &nbsp; &nbsp; &nbsp; &nbsp;aLink := self findLinkFor: anObject ifAbsent: [^aBlock value].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;super remove: aLink ifAbsent: aBlock.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^anObject ! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;removing&#39; stamp: &#39;nice 7/28/2008 21:55&#39;!<br>
removeFirst<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Remove the first element and answer it. If the receiver is empty, create<br>
 &nbsp; &nbsp; &nbsp; &nbsp;an error notification.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^super removeFirst element! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;removing&#39; stamp: &#39;nice 7/28/2008 21:55&#39;!<br>
removeLast<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Remove the first element and answer it. If the receiver is empty, create<br>
 &nbsp; &nbsp; &nbsp; &nbsp;an error notification.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^super removeLast element! !<br>
<br>
<br>
!TransparentLinkedList methodsFor: &#39;enumerating&#39; stamp: &#39;nice 7/28/2008 22:12&#39;!<br>
do: aBlock<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self linkDo: [:aLink | aBlock value: aLink element]! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;enumerating&#39; stamp: &#39;nice 7/28/2008 22:10&#39;!<br>
findLinkFor: anObject ifAbsent: aBlock<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self linkDo: [:aLink | aLink element = anObject ifTrue: [^aLink]].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^aBlock value! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;enumerating&#39; stamp: &#39;nice 7/28/2008 22:15&#39;!<br>
linkDo: aBlock<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;this could be ^super do: but I dislike sending super with a different message selector&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;| aLink |<br>
 &nbsp; &nbsp; &nbsp; &nbsp;aLink := firstLink.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;[aLink == nil] whileFalse:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[aBlock value: aLink.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aLink := aLink nextLink]! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;enumerating&#39; stamp: &#39;nice 7/28/2008 21:57&#39;!<br>
reverseDo: aBlock<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;super reverseDo: [:aLink | aBlock value: aLink element]! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;enumerating&#39; stamp: &#39;nice 7/28/2008 21:58&#39;!<br>
species<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^ self class! !<br>
<br>
<br>
!TransparentLinkedList methodsFor: &#39;accessing&#39; stamp: &#39;nice 7/28/2008 21:58&#39;!<br>
first<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^super first element! !<br>
<br>
!TransparentLinkedList methodsFor: &#39;accessing&#39; stamp: &#39;nice 7/28/2008 21:58&#39;!<br>
last<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^super last element! !<br>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>