On May 7, 2010, at 3:08 33PM, Henrik Johansen wrote: > Yes, this was somehting Nico Schwartz and I did during the sprint. > > He had the idea that it would be nice to be able to add any object to a > LinkedList, instead of just Link subclasses. (IIRC, 'like you can in Ruby' ;)) > > So we added ValueLink as the common pattern for "A link with an object in > it", which is now the default if you add an object which itself is not a > link. > > Makes it much more convenient to actually use a LinkedList, ref. f.ex. the > Stack implementation. > > Sort of similar to what was done in Squeak to add nils to sets, actually. > > Cheers, > Henry Which of course makes it all the more important that it actually returns aLink, rather than aLinkOrObject.
Cheers, Henry > > > On May 6, 2010, at 9:25 52AM, Stéphane Ducasse wrote: > >> LinkedList>>add: aLinkOrObject >> "Add aLink to the end of the receiver's list. Answer aLink." >> >> ^self addLast: aLinkOrObject >> >> LinkedList>>addLast: aLinkOrObject >> "Add aLink to the end of the receiver's list. Answer aLink." >> |aLink| >> aLink := aLinkOrObject asLink. >> self isEmpty >> ifTrue: [firstLink := aLink] >> ifFalse: [lastLink nextLink: aLink]. >> lastLink := aLink. >> ^aLink >> >> Object>>asLink >> "Answer a string that represents the receiver." >> >> ^ ValueLink value: self >> >> >> In squeak there is no such asLink.... >> We need a database with all the history to know which change introduced this >> change. >> Henrik do you remember why you introduce this change? >> >> Stef >> >> >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
