Issue 5587 in pharo: LinkedList broken

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Issue 5587 in pharo: LinkedList broken

pharo
Status: New
Owner: ----

New issue 5587 by [hidden email]: LinkedList broken
http://code.google.com/p/pharo/issues/detail?id=5587

The code in LinkedList is completely broken.

For example, the test for indexOutOfBounds in

at:putLink: is backwards (should be self validIndex: index ifFalse: rather  
than ifTrue:).

LinkedList newFrom: aCollection doesn't work (creates an empty LinkedList).

t:= LinkedList new.
t add: 3.
t add: 4.
t at: 1 put: 2.
t at: 1 put: 4.

hangs the VM because it attempts to link in the existing 4 node rather than  
creating a new one.

Also, the class comment is wrong.  The behavior of LinkedList add: should  
_not_ depend on whether or not the object being added inherits from Link.  
It should depend on whether the message used for the addition is add: or  
addLink:   Trying to be clever here is a bad idea; it violates the "tell,  
don't ask" principle.





_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker